0% found this document useful (0 votes)
62 views1 page

Py4Inf 11 Regex Guide

This document provides a quick reference guide for common Python regular expression syntax including special characters for matching the beginning or end of a line, any character, whitespace, character sets, repetition, and string extraction. It lists regular expression tokens like ^, $, ., \s, *, + and their meanings for matching patterns in text.

Uploaded by

LavThaiba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views1 page

Py4Inf 11 Regex Guide

This document provides a quick reference guide for common Python regular expression syntax including special characters for matching the beginning or end of a line, any character, whitespace, character sets, repetition, and string extraction. It lists regular expression tokens like ^, $, ., \s, *, + and their meanings for matching patterns in text.

Uploaded by

LavThaiba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Python Regular Expression Quick Guide

^
$
.
\s
\S
*
*?

Matches the beginning of a line


Matches the end of the line
Matches any character
Matches whitespace
Matches any non-whitespace character
Repeats a character zero or more times
Repeats a character zero or more times
(non-greedy)
+
Repeats a character one or more times
+?
Repeats a character one or more times
(non-greedy)
[aeiou] Matches a single character in the listed set
[^XYZ]
Matches a single character not in the listed set
[a-z0-9] The set of characters can include a range
(
Indicates where string extraction is to start
)
Indicates where string extraction is to end

Python Regular Expression Quick Guide


^
$
.
\s
\S
*
*?

Matches the beginning of a line


Matches the end of the line
Matches any character
Matches whitespace
Matches any non-whitespace character
Repeats a character zero or more times
Repeats a character zero or more times
(non-greedy)
+
Repeats a character one or more times
+?
Repeats a character one or more times
(non-greedy)
[aeiou] Matches a single character in the listed set
[^XYZ]
Matches a single character not in the listed set
[a-z0-9] The set of characters can include a range
(
Indicates where string extraction is to start
)
Indicates where string extraction is to end

You might also like