Today I had to filter a text log file - the lines without certain sub-string had to be removed.
I wanted to use regular expression for this task, but it turned out that this is not as trivial as I thought. First of all it was hard to find real examples, and second - that not all text editors with "regular expressions support" actually support lookahead and other, kind of, advanced regular expressions stuff.
So, here it is, the regular expression itself:
^(?:(?!actual phrase to be excluded).)*$
Hope this helps someone.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment