I&C SCI 33 Lecture Notes - Lecture 3: Regular Expression, Newline, Carriage Return

51 views2 pages

Document Summary

General rule of matching: regular expressions match the most number of characters possible (greedy algorithm); patterns that match the fewest number of characters possible, etc. Matching: characters generally match themselves, except for the following. [] matches one character specified inside []; e. g. [aeiou] [^] matches one character not specified inside [] after^ e. g [^aeiouy] Matches one character in range inside []: e. g. [0-9] matches any digit. ^ matches beginning of line (when not used in []) Patterns: r, ra, rb are regular expression patterns. Rarb matches a sequence of ra followed by rb. Ra|rb /matches either alternative ra or rb. Matches regex r 0/1 time: r is optional. R* matches regex r 0 or more times. R+ matches regex r 1 or more times. R{m} matches regex r exactly m times; e. g. r{5} = rrrrr. R{m, n} matches regex r at least m times and at most n times; e. g. r{4, 5}

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents