Regular Expression Summary
• c matches the non-metacharacter c.
• \c matches the literal char c and suppresses the special meaning of a metacharacter.
• ^ 1. metacharacter that matches the beginning of a line or string.
• 2. when used in a character class, the ^ negates the character class.
• $ metacharacter, matches the end of a line or string.
• . metacharacter, matches any single character except newline.
• - metacharacter, use to create a character range in a character class.
• [ and ] metacharacters, used to represent a character class.
• r1|r2 alternation: matches either r1 or r2 where r1 and r2 are regular expressions.
• r1r2 concatenation: matches r1, and then r2. r1 and r2 are regular expressions.
• r+ matches one or more r's. r is a regular expression and + is a metacharacter.
• r* matches zero or more r's. * is a metacharacter.
• r? matches zero or one r's. ? is a metacharacter.
• ( and ) (bob) + by matches bobby, bobbobby, bobbobbobby, ...
Last modified date: 10/22/2024