[Wesley Witt] > This is probably a simple question, but I can't seem to find the answer > anywhere. > > I want a regular expression that will match ALL lines that do NOT > contain the string "skip". > ... Like everyone else here, I recommend using the string find() method instead, for this specific case. More generally, if you *need* a regexp, there's a trivial solution: don't screw with the regexp, invert the result of the *test*: searcher = re.compile("skip").search while 1: ... if searcher(line): # found it else: # no "skip" in this line! A funkier way is to fool around with negative lookahead assertions, like searcher = re.compile("(?!.*skip)", re.DOTALL).match This fails to match if it can find "skip", and matches an empty string at the start if it can't find "skip". pick-your-poison-but-look-in-the-mirror-as-you're-dying<wink>-ly y'rs - tim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4