Reputation: 105
I have a regex that finds the consecutive 15 numbers. It works fine in the notepad but when I try to run it on vi editor in Linux, it shows no pattern found. Even though there are numbers of the same length. Here is the regex I am using.
Regex: (?<!\d)\d{15}(?!\d)
Any help will be appreciated.
Upvotes: 1
Views: 147
Reputation: 627082
Note that you need to do several things:
\v
at the start to enable very magic mode to avoid over-escaping(?<!\d)
negative lookbehind to (\d)@<!
(?!\d)
negative lookahead to (\d)@!
\v(\d)@<!\d{15}(\d)@!
Upvotes: 1