Case Insensitivity
The re.IGNORECASE allows the regular expression to become case-insensitive. Here, the match is returned based on the case of the provided string, not the string in the regular expression.
Python3
import re match = re.search(r 'w3wiki' , 'w3wiki' ,re.IGNORECASE) print (match) |
Output
<_sre.SRE_Match object; span=(0, 13), match='w3wiki'>
Python Flags to Tune the Behavior of Regular Expressions
Python offers some flags to modify the behavior of regular expression engines. Let’s discuss them below:
- Case Insensitivity
- Dot Matching Newline
- Multiline Mode
- Verbose Mode
- Debug Mode