Understanding Regular Expressions metacharacters with uses
The ^ (caret) metacharacter – Start of a string
^ (caret) metacharacter matches the characters that occur immediately after the beginning of a line or string.
Suppose we want to search "we"
Text Pattern is – we have holiday on wednesday
It will match the sequence of characters "we" in the words we, and wednesday. However, the same pattern preceded by the ^ metacharacter means "^we" when applied to the same Text Pattern. It will match the sequence of characters "we" occurs immediately after the start of the string.
The $ (dollar) metacharacter – End of a string
$ (dollar) metacharacter matches the characters that immediately precede the end of a line or string.
Suppose we want to search "day"
Text Pattern is – Today we have office but we have holiday on wednesday
It will match the sequence of characters "day" in the words Today, holiday and wednesday. However, the same pattern processed with the $ metacharacter means "day$" when applied to the same Text Pattern. It will match the sequence of characters "day" occurs at the end of a line in the words wednesday.




