Hunt Hunt - 1 year ago 77
Python Question

optional parameter in regular expression

I want to make few paramters optional using regular expression

currently my url is


as there are 5 numbered parameters , now sometimes i want 4 or sometime 5


should be acceptable

here is my regular expression


Answer Source

The ? modifier makes a part of a regular expression optional:


Note the (...)? around the "datafive" subpattern.