The most important metacharacters are the caret (^) and the dollar sign ($).
-
Caret (^) - The regular expression must match at the beginning of a word.
-
Dollar sign ($) - The regular expression must match at the end of the word.
For example:
Example |
Description |
---|---|
/THE/ |
Matches any word that contains the substring "THE", such as "THEATRE" and "SOOTHE". |
/^DAT/ |
Matches any word that begins with the substring "DAT", such as "DATE", "DATUM", and "DATO". |
/ING$/ |
Matches any word that ends with the substring "ING", such as "WALKING" and "KING". |