Reputation: 149
I have below two regex expressions
I want to say A and NOT B. How can I do that.
Thanks in advance for any help.
Upvotes: 0
Views: 106
Reputation: 10360
Try this:
^(?!599999\d{10})\d{13,16}$
Explanation:
^
- asserts the start of the string(?!599999\d{10})
- negative lookahead to validate that the string does not start with 599999
followed by 10 digits\d{13,16}
- matches 13 to 16 digits$
- asserts the end of the stringEdit:
If these numbers are in the same line, you can use this instead \b(?!599999\d{10})\d{13,16}\b
Upvotes: 1