ENG 6 Lecture Notes - Lecture 17: Matlab, Metacharacter

60 views4 pages
11 Sep 2013
School
Department
Course

Document Summary

Matching any character: use dot: identifies any single character, including white space, ex. str = the rain in spain falls mainly on the plain. "; Locate sequences of 5 consecutive characters that end in ain". Startindex = 4 13 24 39 regexp(str,"ain","match") Selected characters [c1c2c3: matches any character contained within brackets. [c1-c2: matches any character in the range of c1 through c2. Str = "the rain in spain falls mainly on the plain. >> [mat idx] = regexp(str, "[a z]\w*", "match", "start") Mat = "the" "spain" idx = 1 13. \s any white space character: str = "the rain in spain falls mainly on the plain, >>[mat ix1 ix2] = regexp(str, "\w*n\s", "match", "start", "end") mat = "rain " "in " "spain " ix1 = "on " find all words starting with lower case m or capital m and ending with y. Str = "my flowers may bloom in may";

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