Commit 96096407 authored by Igor Dejanovic's avatar Igor Dejanovic

Added flags parameter to RegExMatch.

It is used to pass re flags to compile function.
parent 59b4c15d
......@@ -348,13 +348,16 @@ class RegExMatch(Match):
'''
This Match class will perform input matching based on Regular Expressions.
'''
def __init__(self, to_match, rule=None):
def __init__(self, to_match, rule=None, flags=None):
'''
@param to_match - regular expression string to match.
'''
super(RegExMatch, self).__init__(rule)
self.to_match = to_match
self.regex = re.compile(to_match)
if flags is not None:
self.regex = re.compile(to_match, flags)
else:
self.regex = re.compile(to_match)
def _parse(self, parser):
m = self.regex.match(parser.input[parser.position:])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment