I am receiving an error on the .match regex module function of TypeError: An integer is required.
Here is my code:
hAndL = hAndL.replace('epsilo\ell','epsilon')
pattern = re.compile("\frac{.*?}{ \frac{.*?}{.*?}}")
matching = pattern.match(pattern,hAndL)
hAndL is a string and pattern is a..pattern.
I'm not sure why this error is happening, any help is appreciated!
When you
re.compilea regular expression, you don't need to pass the regex object back to itself. Per the documentation:The
patternis already provided, so in your example:is equivalent to:
where the third parameter to
re.matchisflags, which must be an integer. Instead, you should do: