N6. Java Regex Flashcards
1
Q
What is a possible use of a Regular Expression?
A
used for parsing and checking user inputs and messages within protocol
2
Q
REGEX
^ character
A
beginning of a line
3
Q
REGEX
$ character
A
end of a line
4
Q
REGEX
\ character
A
escapes a meta character
5
Q
REGEX
\d
A
[0-9] digits
6
Q
REGEX
\D
A
[^0-9] (anything other than digits 0-9)
7
Q
REGEX
\w
A
word character (same as [A-Za-z0-9_])
8
Q
REGEX
\b
A
word boundary
9
Q
REGEX
[abc]
A
match ‘a’, ‘b’, or ‘c’
10
Q
REGEX
[^abc]
A
match anything but ‘a’, ‘b’, or ‘c’
11
Q
REGEX
[a-z]
A
match characters in the range ‘a’-‘z’
12
Q
REGEX
repetition characters
A
{ } curly brackets
13
Q
REGEX define a class of characters
A
[ ] square brackets
14
Q
REGEX
\d{2,5}
A
between 2 and 5 digits
15
Q
REGEX
\d{5,}
A
5 or more digits