I am trying to ignore the character @ with random numbers combined using RegEx.
This is what I don't want to detect:
@1235
This is what I want to detect:
12345
This what I did so far:
(?!@[0-9])([0-9])
CodePudding user response:
You can use
(?<![@\d])\d
CodePudding user response:
You want to assert that there is no @ to the left with a negative lookbehind (?<! instead of a negative lookahead (?!
\b(?<!@)\d
Explanation
\bA word boundary to prevent a partial word match(?<!@)Negative lookbehind, assert not @ to the left\dMatch 1 digits

