I’m trying to write a regex to match any path that contains /? to determine whether it is a querystring or not.
a sample string to be matched would be this: /mysite/path/to/whatever/?page=1
so far I thought this would match re.match(r'/\?', '/mysite/path/to/whatever/?page=1')
but it doesn’t seem to be matching
Your problem is that you’re using
re.match. That function looks for matches at the beginning of the string. So, either you change your regexp to'.*/\?', or usere.searchinstead.