Skip to content

Commit a0c3d46

Browse files
committed
reinstate John Ombagi alternate quantifiers
1 parent f536098 commit a0c3d46

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cheatsheet.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Python 2.7 Regular Expressions
33

44
Non-special chars match themselves. Exceptions are special characters::
55

6-
\ Escape special char
6+
\ Escape special char or start a sequence.
77
. Match any char except newline, see re.DOTALL
88
^ Match start of the string, see re.MULTILINE
99
$ Match end of the string, see re.MULTILINE
1010
[] Enclose a set of matchable chars
1111
R|S Match either regex R or regex S.
12-
() Create capture group, and indicate precedence
12+
() Create capture group, & indicate precedence
1313

1414
After '``[``', enclose a set, the only special chars are::
1515

@@ -19,11 +19,11 @@ After '``[``', enclose a set, the only special chars are::
1919

2020
Quantifiers (append '``?``' for non-greedy)::
2121

22-
* 0 or more
23-
+ 1 or more
24-
? 0 or 1
25-
{m} Exactly 'm'
22+
{m} Exactly m repetitions
2623
{m,n} From m (default 0) to n (default infinity)
24+
* 0 or more. Same as {,}
25+
+ 1 or more. Same as {1,}
26+
? 0 or 1. Same as {,1}
2727

2828
Special sequences::
2929

0 commit comments

Comments
 (0)