Regex Flashcards

1
Q

Regex - any digit / any non digit

A

Any digit - \d

Any no digit - \D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Regex - any character

A

Any character - .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Regex - only certain character / only not certain character

A

Only - [those character / a-z for short form from A to Z]

Not - [^ those character]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Regex - any alphanumeric character / not

A

Any - \w

Not - \W

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Regex - repetition of n

A

Ans - n{x, y} / n {x}

N repeats from x to y times
N repeats x times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Regex - zero or more repetition / one or more repetition

A

Zero - *

One - +

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Regex - special characters (need to add )

A

.*+^?$()[]{}|\

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Regex - any white space / any not white space

A

Any - \s

Not - \S

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Regex - starting at / ending with

A

Start - ^ (put in front of the regex)
eg: ^abc -> string start with abc will be recognised
End - $ (put in the end of the regex)
eg: abc$ -> string end with abc will be recognised

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Regex - matching two possibilities

A

(abc|def)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly