I'm trying to parse a barely formated text to a price list. I store a bunch of regex patterns in a file looing like this:
[^S](7).*(\+|(plus)|➕).*(128)
When i attempt to verify whether there is a match like this:
def trMatch(line):
  for tr in trs:
    nr = re.compile(tr.nameReg, re.IGNORECASE)
    cr = re.compile(tr.colourReg, re.IGNORECASE)
    if (nr.search(line.text) is not None): doStuff()
I get an error
File "<stdin>", line 1, in <module>
  File "<stdin>", line 10, in go
  File "<stdin>", line 3, in trMatch
  File "/usr/lib/python3.5/re.py", line 224, in compile
    return _compile(pattern, flags)
  File "/usr/lib/python3.5/re.py", line 292, in _compile
    raise TypeError("first argument must be string or compiled pattern")
TypeError: first argument must be string or compiled pattern
I assume it can't compile a pattern because it is missing 'r' flag. Is there a proper way to make this method to cooperate?
Thanks!
 
    