Posts

Showing posts from October, 2017

regular expressions for pattern

Common Matching Expressions Regular Expression Description . Matches any character ^regex Finds regex that must match at the beginning of the line. regex$ Finds regex that must match at the end of the line. [abc] Set definition, can match the letter a or b or c. [abc][vz] Set definition, can match a or b or c followed by either v or z. [^abc] When a caret appears as the first character inside square brackets, it negates the pattern. This pattern matches any character except a or b or c. [a-d1-7] Ranges: matches a letter between a and d and figures from 1 to 7, but not d1. X|Z Finds X or Z. XZ Finds X directly followed by Z. $ Checks if a line end follows. Metacharacters The following metacharacters have a pre-defined meaning and make certain common patterns easier to use, e.g.,  \d  instead of  [0..9] . Regular Expression Description \d Any digit, short for  [0-9] \D A non-digit, short for  [^0-9] \s A whitespace character,