The syntax of regular expression is basically the combination of the
metacharacters and the regular characters. For example:
| ^My
| matches line starting with the word "My"
|
| finally$
| matches ending with the word "finally"
|
| ^I am a boy$
| matches the whole line of the sentence "I am a boy"
|
| \$10
| matches "$10", meaning of $ is turned off
|
| t.e
| matches "t" followed by any one character and then an "e"
|
| my*
| matches "m" and followed by any number of occurances of "y"
|
| th.*
| matches "th" and followed by any characters including no character
|
| [124]
| matches one of "1" or "2" or "4"
|
| [12-46]
| matches one of "1" or "2" or "3" or "4" or "6". Expanded as "2-4", not twelve to fortysix.
|
| [^abc]
| matches any one except "a" and "b" and "c"
|