|
|
You specify the patterns you are interested in with a notation called a regular expression. A regular expression is formed by stringing together characters with or without operators. The simplest regular expressions are strings of text characters with no operators at all:
apple orange pluto
These three regular expressions match any occurrences of those character strings in an input text. If you want to have the scanner remove every occurrence of orange from the input text, you could specify the rule
orange ;Because you specified a null action on the right with the semicolon, the scanner does nothing but print out the original input text with every occurrence of this regular expression removed, that is, without any occurrence of the string orange at all.