String | a1 | 45 | ab23 | cd36 | 44ee | aaa | abcd |
---|---|---|---|---|---|---|---|
Match or Reject? |
Accept | Accept | Accept | Reject | Reject | Accept | Reject |
Regular Expression (Delimit with quotes) |
|
String (Delimit with quotes) |
|
Time to practice with disjunction. For each row of the following table, find a regular expression that matches each example string in that row.
Language | Example Strings | ||
---|---|---|---|
Any number of A's or any number of B's | AAA | BBBB | Ø |
One or more A's or any single character not an A | AAA | C | x |
An integer or a decimal fraction | 143 | 834.91 | 89.0 |
For the last row, ensure that if the string has a decimal point, then the decimal point is followed by at least one digit (a single digit zero is acceptable after a decimal point). Remember to escape the decimal point with a backslash.
Determine the regular expressions