
Regular Expression Example Questions:
Write Regular expressions to do the following:
1. Match 0 or more characters:
.*
2. Match 1 or more characters:
.+
3. Match any sequence of letters in upper or lower case, but there
must be at least 1 letter:
[a-zA-Z]+
4. Match any letter that is the range of a to d (lowercase):
[a-d]
5. Match any character that is not in the range a to d:
[^a-d]
6. Match any sequence of at least one word character:
\w+
7. Match a sequence of exactly four word characters:
\w{4} or \w\w\w\w or [a-zA-Z_]{4}
8. Match any digit:
\d or [0-9]
9. Match anything that is not a digit:
\D