The pattern (?<!(asp|php|jsp))\?.* works in PCRE, but it doesn’t work in Python.
So what can I do to get this regex working in Python? (Python 2.7)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It works perfectly fine for me. Are you maybe using it wrong? Make sure to use
re.searchinstead ofre.match:Which is exactly how your pattern should behave. As glglgl mentioned, you can get the match if you assign that
Matchobject to a variable (saym) and then callm.group(). That yields?1=123.By the way, you can leave out the inner parentheses. This pattern is equivalent: