go to previous page   go to home page   go to next page

Write a RE that matches binary numbers

Answer:

[01][01]*


Star Practice

Regular Expression
(Delimit with quotes)
String
(Delimit with quotes)

Complicated regular expressions can be built with what you have seen so far. It would be helpful to pause for some practice. Verify that the following table is correct. (Remember, you can copy and paste from the table to the applet.) (Also remember to be careful about spaces at the beginning and end of expressions and strings.)

Two of the regular expressions match the empty string Ø. To send an empty string, use ""

Regular Expression Matches Non-Matches
[0]*[1-9]* 008 1234 10012 07890
[A-Z][a-z]* Able Betty AAron betty
[^aeiou]*[aeiou]* dwoo Ø noon ohm

QUESTION 18:

Write a regular expression that matches strings that start with an A, end with a Z, and have any number of captial letters except A or Z in the middle.