COMPSCI 61B Lecture Notes - Lecture 28: Camel Case, Escape Character, Regular Expression
Document Summary
Expanded regex syntax operation example matches does not match wildcard . u. u. u. Cumulus, jugulum succubus, tumultuous character class [a-za-z][a-z]* word, capitalized camelcase, 4illegal at least 1 m(oo)+n moon, moooon mn, mon between a and b m[aeiou]{1,2}m mem, maam, miem mn, mooom, meme occurrences. More regex features operation example matches does not match (nongreedy quali er) 5*?5 5005, 55 5005005 built-in character class w+ fawef this person. D+ 231231 423 people character class negation [^a-z]+ peppers3982 porch, clams escape character cow. com cow. com cowscom. For every regex in expanded syntax, there is a regex in basic syntax. Anything involving counting (same number of instances of a and b) String class has a method called matches s. matches(regex); Pattern is a class that holds regex patterns. Matcher nds matches and stores them in groups. The canonical algorithm for matching a regular expression can be cast as a graph traversal problem.