View on GitHub

reading-notes

Automation

LINKS

Python Regular Expressions Tutorial

Regular Expressions, often shortened as regex, are a sequence of characters used to check whether a pattern exists in a given text (string) or not.

Regular Expressions in Python

Regular expressions are supported by the re module. That means that if you want to start using them in your Python scripts, you have to import this module with the help of import

Basic Patterns: Ordinary Characters

Ordinary characters are the simplest regular expressions. They match themselves exactly and do not have a special meaning in their regular expression syntax.

The match() function returns a match object if the text matches the pattern. Otherwise, it returns None. The re module also contains several other functions

Back to Homepage