4.4.2.3 Regular expressions and 4.4.2.4 Regular language Flashcards

1
Q

What does [A-Z] / [0-9] mean?

A

exactly one instance of a capital letter

exactly one instance of 0-9

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

What does + mean?

A

Matches between one and unlimited times

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

What does * mean?

A

Matches between zero and unlimited times

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

What does ? mean?

A

0 or 1 repetitions, ie optional

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

What does | mean?

A

or

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

What does \d or \s mean?

A

Any digit

any whitespace character

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

What is the relationship between

regular expressions and FSMs.

A

Regular expressions and FSMs are equivalent

ways of defining a regular language.

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

What is a regular language?

A

if it can be represented by a regular expression.

any language that a FSM will accept.

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

What is a:
natural language
formal language ?

A

Natural - comprises of a set of words written and spoken by humans
Formal - Used for the precise definition of syntactically correct programs for a programming language
The alphabet is defined as a finite set of symbols
The rules of syntax define how to construct strings of the language out of symbols
It is not feasible to list all the strings. Instead Regular expressions are used.

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

What is a regular expression?

A

expressing the language that a machine can use in a formal manner
They provide a means of identifying if a string of characters is allowed in a particular language

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

What does n[^t] mean?

A

An n followed by a character that is not a t

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