Software Methods and Tools

Kenneth M. Anderson <kena@cs.colorado.edu>

Lecture 06: Pattern Matching

Today's Lecture

Don't Forget!!

Open today from 11 AM to 11:55 PM. Go to the class moodle to take the quiz.

Pattern Matching

Wildcards

Metacharacter Name Meaning
* asterisk matches zero or more characters
? question mark matches a single character
[abc] square brackets matches ONE character in the set a, b, or c
[!abc] square brackets matches ONE character NOT in the set a, b, or c
[a-z] square brackets matches ONE character in the range a-z
[!a-z] square brackets matches ONE character NOT in the range a-z
{ab,cd,de} curly braces matches among a set of substrings
\ backslash interpret the next character literally
any other character   matches itself, e.g. an “a” character will match an “a” in the target string

Simple Examples

More on Ranges

Brace Expansion

Revisiting Lab 1

Generating wildcard expressions

Regular Expressions

Regular Expression Syntax

Examples of regular expressions

Differences between wildcards and regular expressions

Captures

Regular Expression Strategies

Examples

Coming Up Next