November 2017
Beginner to intermediate
204 pages
5h 23m
English
The first step to creating a regular expression in Python is to import the re module:
import re
Python regular expressions are expressed using pattern strings, which are strings that specify the desired search pattern. In its simplest form, a pattern string can consist only of letters, numbers, and spaces. The following pattern string expresses a search query for an exact sequence of characters. You can think of each character as an individual pattern. In later examples, I will discuss more sophisticated patterns:
import repattern_string = "this is the pattern"
The next step is to process the pattern string into an object that Python can use in order to search for the pattern. This is done using the ...
Read now
Unlock full access