Further, the "//" operator can be modified to include
complex pattern matching routines. For example, the
period (.) matching operator is used to stand for "any"
character. Thus, "/eri./" would match any occurrences of
"eric" as well as "erik".
Another commonly used matching operator is the
asterisk (*). The asterisk matches zero or more
occurrences of the character preceding it. Thus, "/e*ric/"
matches occurrences of "eeeeeric" as well as "eric".
The following table includes a list of
useful matching operators.
||Digit (same as [0-9])
||Any non-digit (same as [^0-9])
||A Word Character (same as [0-9a-zA-Z_])
||A Non-word character
||Any white space character (\t, \n, \r, or \f)
||A non-white space character
||Zero or more occurrences of the preceding character
||One or more occurrences of the preceding character
||Zero or one occurrences of the preceding character