The basic flags are I, L, M, S, U, X:
- re.I: This flag is used for ignoring casing
- re.M: This flag is useful if you want to find patterns throughout multiple lines
- re.L: This flag is used to find a local dependent
- re.S: This flag is used to find dot matches
- re.U: This flag is used to work for unicode data
- re.X: This flag is used for writing regex in a more readable format
We have mainly used re.I, re.M, re.L, and re.U flags.
We are using the re.match() and re.search() functions. Both are used to find the patterns and then you can process them according to the requirements of your application.
Let's look at the differences between re.match() and re.search():
- re.match(): This checks for a match of the string only at the beginning ...