Block B

Regular Expressions

Characterclassese This is the super-little language of character wildcards.

Here are list character classes. These can contain asciicographical ranges. Inside of these, - is a magic character and must be defanged with a \. This is also true for [ and ].

[a-j]  matches any character in the asciicographical range a-j.
[aqm5$] matches any of the characters (list character class)
[a-zA-Z]  matches any alpha character
[0-9]     matches any digit

sNOTty Character Classes

[^a-z]    matches anything BUT a-z.
^ must go at start or it's just a ^.
[^a-zA-Z0-9]  matches any non alphanumeric chaacter.

Special Character Classes

.  matches any character except \n
^  matches start-of-line
$  matches end-of-line
\d matches a digit in most dialects.
\s matches whitespace

All non-magic characters are character classes matching onlhy themselves.

Regexese This is a little language that specifies patterns in text.

Juxaposition "and then immediately."

a[bcd][0-9]

starts with a
then a character b, c or d
then a 0-9.

ad7  
cowabungad7  

..eati..

any two chs except newline
e
a
t
i
any two chs except newline

defeating
cheating
treating
creating
creation


^..eati..$

cheating
treating
ideation


Match a valid telephone number of the form XXX-XXX-XXXX

^[2-9][0-9][0-9]-[2-9][0-9][0-9]-[0-9][0-9][0-9][0-9]$
^[2-9][0-9]{2}-[2-9][0-9]{2}-[0-9]{4}$

Multiplicity operator is a postfix unary operator.
Juxtapositoin has lower precedence.

{m, n}  at least m but not more than n 
{m,}    at least m
{m}     exactly m 
*       zero or more of
+       one or more of

\s+