Regex Guess and Test
There is nothing to hand in for this assignment, but please work through it thoroughly so that you can easily do the homework for next weekend. We will only cover repetition and alternators briefly in class, so this practice is important, even though I am not asking you to hand anything in.
Please go through this sheet (right click to download) all the way through 5.14 guessing an answer and then testing it in http://www.zytrax.com/tech/web/regex.htm all your answers.
Here is a full explanation of the *, + and ? and {} characters and a redo of the examples on the board.
code | will match | won't match |
tr*s |
ts |
tris txs |
tr+s | trs trrs trrrs |
ts tris txs |
tr?s | ts trs |
trrs tris txs |
tr{2,3}s | trrs trrrs |
ts trs trrrrs |
tr{2}s | trrs |
ts trs tris trrrs trrrrs trris |