I need a regular expression that does not match when a character exists in string after a specific character.
For example my first character is ‘X’ and the character that is no allowed after is ‘U’.
Following is valid:
eUpXssseeeree // U is before X
rtsssXeeeree // U is not there at all
Following is NOT valid
ereXUppsrrrsssss // U is there right after X
ereeXrerrrtogUoosss // U is still there even after a few characters
I’m using C# syntax. Can you guide me on how to write such a regular expression?
Sounds like it could be as straightforward as "any characters, followed by
X, followed by any characters that aren’tU":(see reFiddle example)
Of course, you want to make sure to match the entire string by using start
^and end$characters.