Reputation: 825
I want to match all the numbers not followed by a Doller
:
100Dollar
1000Dollar
100Yuan
1000Yuan
the regex:
\d+(?!Dollar)
But the result is weird:
Live example:
Upvotes: 0
Views: 68
Reputation: 23307
Add a digit class to the negative lookahead to assure that you match till the then of a number:
\d+(?!Dollar|\d)
Upvotes: 1
Reputation: 3405
Regex: (?!\d+Dollar)\d+
Details:
(?!)
Negative Lookahead\d
Matches a digit (equal to [0-9]
)+
Matches between one and unlimited timesUpvotes: 2