Programming with Python

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

Regular expressions in python

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

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

We can easily import regular expression in python.

syntax:-

import re
  • [] – A set of characters
  • \ – Signals a special sequence.
  • . – Any character
  • ^ – Starts with
  • $ – Ends with
  • * – Zero or more occurrence
  • + – One or more occurrence
  • {} – Exactly the specified number of occurrences.
  • | – Either or
  • () – Capture and group

This is all about regular expression in python.

Articles

Was this article helpful to you? Yes No

How can we help?