I need to use PLY for a parser, and PLY forces you to write regular expressions in string ntoation inside a token definition. For example (from the docs):
# A regular expression rule with some action code
def t_NUMBER(t):
r'\d+'
t.value = int(t.value)
return t
# Define a rule so we can track line numbers
def t_newline(t):
r'\n+'
t.lexer.lineno += len(t.value)
I was wondering how to write more complex regular expressions using this notation, specifically how to use the IGNORECASE flag for the RE.