Reputation: 67
I need a regexp, that matches \n
everywhere, except \\\\\n
(n
with multiple \
) Every other variant is suitable.
For example:
SOMETEXT\nANOTHERTEXT
- want \n
here to match my regexp
\\\\\\\\\\\\\\\n
- this shouldn't match
\\\\\\\sdfsdfsdf\\\n
- this shouldn't match
\\\\\\s\n
- this should match
\n
- this should match
Sorry, if it's a dumb question, I tried googling, but with no success
Upvotes: 0
Views: 82
Reputation: 70750
I believe you are looking for a Negative Lookbehind here.
(?<!\\)\\n
See Demo
Upvotes: 1
Reputation: 115398
You need negative lookahead. Try something like this: (?!\\)\n
. Probably you have to duplicate the slashes, i.e. write something like (?!\\\\)\n
Upvotes: 1
Reputation: 585
Tried using "\\n"
as a pattern?
For clarification the first \
is just for escaping special character
Upvotes: 1