Programming with Python

  1. Home
  2. Docs
  3. Programming with Python
  4. Regular expressions in python
  5. Modifiers


Regular expression in is a sequence of characters that forms a search pattern.

It is used to confirm whether the string has that particular term or not.

We can easily import regular expression in python.

Regular expression literals may include an optional modifier to control various aspects of matching. The modifiers are specified as an optional flag.

  • re.I – It performs case insensitive matching.
  • re.L – Interprets words according to the current locale. This interpretation affects the alphabetic group, as well as word boundary behavior.
  • re.M – It makes match the end and the start of the line.
  • re.S – Makes a match of any character.
  • re.U – Interprets letters according to the Unicode character set.
  • re.X – It ignores whitespace and treats unescaped # as a comment marker.

Was this article helpful to you? Yes No

How can we help?