08. Metacharacters - The Character Class
- By using character classes, we can already start to write some
regular expressions that are more interesting and more powerful
than we could when we only knew about literal characters.
- For example, let's extend the regular expression that we had before:
[ea]
by adding some more detail:
gr[ea]y
- We now have a very useful regex, that can match either the word
"grey" or the word "gray"!
- This would be ideal for finding words that someone may have spelt differently
throughout a document.
|