Solved: Case insensitive regular expression without re.compile?


In Python, I can compile a regular expression to be case-insensitive using re.compile:
Is there a way to do the same, but without using re.compile. I can’t find anything like Perl’s i suffix (e.g. m/test/i) in the documentation.

Best Answer:

Pass re.IGNORECASE to the flags param of search, match, or sub:

If you have better answer, please add a comment about this, thank you!