regex - Match newlines except if it ends with semicolon -


i want match newline \n except when line ends semicolon. attempt far (?!;\n)\n matches newline doesn't exclude anything. sample text:

this line of text should match should exclude line; line should ignored; should match 

to match \n not preceded ; in notepad++, can use

\n(?<!;\n) 

or

(?<!;)\n 

see regex demo

the (?<!...) look-behind zero-width assertion checks not consume text before text match (the \n symbol). tried look-ahead checks text right after text matched.

the same construct in vim \(....\)\@<!:

\n\(;\n\)\@<! 

or

\(;\)\@<!\n 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -