Reputation: 682
I would like to ask for help with the regular expression to use in Notepad ++ that will find any text that is 50 or longer, and is between 2 vertical bars?
Example:
060801113494|I am writing a string that is longer that 50 characters|1054.70|2020-12-10 10:27:20|My Test|10511078
I saw some examples and have this version, but it is not working:
\|(?:(?!\|).){50,}
The string can contain special characters.
Thank you, Erasmo
Upvotes: 1
Views: 1368
Reputation: 163477
The pattern \|(?:(?!\|).){50,}
matches the leading |
and does not make sure that there is a closing one.
You can match a pipe, then forget what is matched so far and continue matching 50 or more chars other than a |
while asserting one at the end.
\|\K[^|]{50,}(?=\|)
Explanation
\|
Match a |
\K
Forget what is matched so far[^|]{50,}
Match 50+ times any char except |
(?=\|)
Positive lookahead, assert a |
at the rightUpvotes: 1