-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathregex.txt
More file actions
48 lines (39 loc) · 787 Bytes
/
regex.txt
File metadata and controls
48 lines (39 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
REGEX
BASIC MATCHING
. anything
\d digit
\D non-digit
\w "word" (alnum & _)
\W non-"word"
space
\t tab
\r return
\n line feed
\s whitespace( ,\t,\r,\n)
\S non-whitespace
Character Class
-defined by the space between brackets
[qwerty] matches any character in qwerty
[^qwerty] matches any character not in qwerty
[0-9a-f]
[0-9a-z]
[0-9a-zA-z]
Boundaries
--"anchors"
\b word boundry (non-whitespace chars between a \w & a \W)
\B non-word boundary
^ matches beginning of line
$ matches end of line
Disjunction
-exclusive or clause
(a|A)
x(x|xy)
(this|that)
Quantifiers
a* 0+ repititions
a+ 1+ repititions
a? 0 or 1 repititions
a{1} exactly 1 repitition
a{1,} at least 1 repitition
a{1,3} between 1 & 3 repititions
(xo){2} two repitions, multiple characters