-1

I have been searching inverse regex and wasn't able to find one.

I have prepared a regex that finds a specific pattern in the table.

Regex: ^R([0-9]{3}|[0-9]{4})[-][a-zA-Z]{2,3}[-]([0-9]{5}|[0-9]{4})$
Example: R788-COV-2040

Now I want to find all values that do not follow this regex pattern.

Every answer online is about not containing a specific string but not regex.

Faizan Sh
  • 96
  • 1
  • 13
  • Look up "negative lookbehind" – Barmar Jun 17 '20 at 21:08
  • 1
    https://www.regular-expressions.info/lookaround.html – Barmar Jun 17 '20 at 21:08
  • on that supr dupr, check answer by @AlanMoore. that is typical and is like mine. the _Accepted_ answer is mostly links that requires hours of investigation but do not directly ansers the question. –  Jun 17 '20 at 21:21
  • As I understand, you are given a regex that matches one or more substrings of a given string, `s1`, `s2`, `s3`,... and you want to construct a second regex that matches the substrings between `s1` and `s2`, `s2` and `s3` and so on. If that is correct, there is a problem in that no "inverse" regex may exist or there may be more than one that works, in which case I would doubt that one could be derived from the given regex. An analogy from mathematics is that there is no inverse function of `f` when `f(x) = 0` for all `x`. – Cary Swoveland Jun 17 '20 at 23:18

1 Answers1

0

negate what do not want ^(?!R([0-9]{3,4})-[a-zA-Z]{2,3}-([0-9]{4,5})$).+

demo

nate - i facterded yuor regex a bit, good perform now