Regular Expressions 101

Community Library Entry

0

Regular Expression
Python

r"
Page\s(\d+)\sof\s\1$
"
gm

Description

Only matches patterns like "Page 1 of 1", "Page 2 of 2", "Page 3 of 3", "Page 4 of 4", "Page 106 of 106", etc.

Only works when page numbers in the string are the same.

Submitted by anonymous - a year ago