I&C SCI 33 Lecture Notes - Lecture 6: Newline, Regular Expression

70 views2 pages

Document Summary

Creates compiled pattern object: returns a match object, consisting of tuple of groups (0,1,) match(pattern, text [,flags]) search(pattern, text [,flags]) Matches can start anywhere in the text: returns a list of string/of tuples of string (the groups), specifying matches findall(pattern, text [,flags]) Matches can start anywhere in the text; the next attempted match starts one character after the previous match terminates: returns a iterable of the information returned by findall (ignore this one) finditer(pattern, text [,flags]) Returns iterable equivalent of findall: returns a list of strings: much like calling text. split() split(pattern, text [,maxsplit, flags]) like the text. split() method, but using a regular expressions pattern to determine how to split the text: re. split("\. | ", "a. b c") returns. For example, in the pattern (a)(b(c)(d)) the a is in group 1, the b is in group 2, c is. Groups are numbered by in what order we reach their opening parenthesis.

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