Build your own
1. All of these expressions are built around character classes. Character classes are a grouping which will match exactly a single character out of the class.
Some characters need to be escaped (obviously the [ and the ] characters) or they will interfere. To escape the character prepend a \
For example:
[ABC] matches a single letter of A, B, or C (but not a,b or c).
[\[\]] matches [ or ]
2. A grouping processes a chunk of letters together. This is useful for optional matches and debugging. You can of course have groups within other groups.
For example:
(cat)|([Dd]og)
will match, cat, Dog and dog
3. The following symbols denote the number of matches in a group or subgroup
* - 0 to infinity
+ - 1 to infinity
? - 0 to 1
{number} - exactly the number of matches
{min, max} - between min and max matches.
For example:
Cats?|Dogs?
will match Cat, Cats, Dog and Dogs.
Frogs*
will match Frog, Frogs, Frogss, Frogsss and so on
(Frogs)+
will match Frog, FrogsFrogs, FrogsFrogsFrogs and so on.
4. The following symbols have special meaning.
. - matches any character
\s - matches any space
\w - matches any word character
For example:
.* - matches any number of any characters.
\w* - matches any number of non-space characters.
\s* - matches any number of spaces.
\s+ - at least one space.