Regex Flashcards
1
Q
Regular expressions
A
A language independent approach to expressing patterns
2
Q
Hierarchy of languages
A
Type 0: unrestricted grammars
Type 1: context-sensitive grammars
Type 2: context-free grammars
Type 3: regular grammars
Type 2 used in parsers
Type 3 used in regular expressions and lexical analyzers
3
Q
Grep
A
Global regular expression print
- arg 1: a regex
- arg 2: a set of files where grep will try to find strings matching regex
4
Q
A
Start with
5
Q
[^]
A
Not in set
6
Q
.
A
Any char
7
Q
-w
A
Contains that specific word
8
Q
-i
A
Case insensitive
9
Q
$
A
Ends with
10
Q
a*
A
Zero or more reps of ‘a’
11
Q
a+
A
one or more reps of ‘a’
12
Q
a?
A
Zero or one rep of ‘a’
13
Q
a{5}
A
Exactly 5 reps of ‘a’
14
Q
a{3,7}
A
3 to 7 reps of ‘a’
15
Q
[abc]
A
Any one char in the set