Do not match if word appears in regex
Posted
by
David542
on Stack Overflow
See other posts from Stack Overflow
or by David542
Published on 2014-08-22T22:06:03Z
Indexed on
2014/08/22
22:20 UTC
Read the original article
Hit count: 171
I have a url, and I want it to NOT match if the word 'season' is contained in the url. Here are two examples:
CONTAINS SEASON, DO NOT MATCH
'http://imdb.com/title/tt0285331/episodes?this=1&season=7&ref_=tt_eps_sn_7'
DOES NOT CONTAIN SEASON, MATCH
'http://imdb.com/title/tt0285331/
Here is what I have so far, but I'm afraid the .+
will match everything until the end. What would be the correct regex to use here?
r'http://imdb.com/title/tt(\d)+/.+^[season].+'
© Stack Overflow or respective owner