*. zero or more of the preceeding character. A* = blank (empty string), A, AA, AAA,…

Post on 05-Jan-2016

217 views 1 download

Transcript of *. zero or more of the preceeding character. A* = blank (empty string), A, AA, AAA,…

*

zero or more of the preceeding character. A* = blank (empty

string), A, AA, AAA,…

+

1 or more of the preceeding character. B+ = B, BB, BBB, …

?

zero or one of the preceeding char. A? = blank, A

|

OR. A|B = A, B alternative = [ ]

(a+|b+)cc

acc, bcc, aacc, bbcc, GROUPING: gray | grey = gr(a|e)y; @([_a-zA-Z\d\-]+(\.[_a-zA-

A\d\-]+)+)

{a, b, c}

{ } the set of alphabet for a language

\

backslash = escape (the orginal meaning of the char follows it). \. = decimal point, . = any char

[ab]

a or b. [a-z] = a single char between a-z.

^ caret

NOT. ^t = the string cannot contain t

. Period or dot

any character (almost)

- class, inside [ ]

[a-z] matches all 26 letters. [a-zA-Z] matches all 52 letters.

Hyphen

$ the dollar sign

\d

matches a single numeric character, [0-9];

\w

matches a single alphanumeric character = [a..z, A..Z, 0..9] [a-

zA-Z0-9]

\W

matches a non-alphanumeric character = [^\w]

\D

matches a non-numeric character = [^\d]

\s

matches a single space character

\S

matches a single non-space character

[\.\d+]

=.123, or .365, etc

* and +

first, then concatenation, then | (or)

BNF

::=; <non-terminal symbols>; | ; terminal symbol; alphabet

Syntax diagram

non-terminal symbols rect box; terminal symbols oval box.

RPN

Reversed Polish Notation, Postfix notation, simpler for

machine to evaluate. No brackets.

(0|1)*

any order. * first then the |.