MATLAB Programming Fundamentals - MathWorks
Regular Expressions In this section... “What Is a Regular Expression?” on page 2-41 “Steps for Building Expressions” on page 2-4 ...
To be more efficient, however, you can build a single phrase that applies to all of these search terms: Translate this phrase in ...
When calling any of the first three functions, pass the text to be parsed and the regular expression in the first two input argu ...
ans = 'Janice 529-882-1759 Fresno, CA
[email protected]
' Step 1 — Identify Unique Patterns in the Text A typical email ad ...
Description of each segment Pattern Dot (period) character . com or net (com|net) Assembling these patterns into one character v ...
regexp(contacts{5}, email, 'match') ans = 1×1 cell array {'
[email protected]
'} You can also search for the email address of ...
Metacharacter Description Example . Any single character, including white space '..ain' matches sequences of five consecutive ch ...
Metacharacter Description Example \xN or \x{N} Character of hexadecimal value N '\x2C' matches the comma character, defined by h ...
Quantifier Matches the expression when it occurs... Example expr{m,} At least m times consecutively. {0,} and {1,} are equivalen ...
Grouping Operator Description Example (expr) Group elements of the expression and capture tokens. 'Joh?n\s(\w*)' captures a toke ...
Anchor Matches the... Example expr> End of a word. '\w*e>' matches any words ending with e. Lookaround Assertions Lookaround ass ...
For more information, see “Lookahead Assertions in Regular Expressions” on page 2-57. Logical and Conditional Operators Logical ...
Ordinal Token Operator Description Example \N Match the Nth token. '<(\w+).>.</\1>' captures tokens for HTML tags, s ...
Dynamic Expressions Dynamic expressions allow you to execute a MATLAB command or a regular expression to determine the text to m ...
For more information, see “Dynamic Regular Expressions” on page 2-69. Comments The comment operator enables you to insert commen ...
See Also regexp | regexpi | regexprep | regexptranslate More About “Lookahead Assertions in Regular Expressions” on page 2-57 “ ...
Lookahead Assertions in Regular Expressions In this section... “Lookahead Assertions” on page 2-57 “Overlapping Matches” on page ...
Overlapping Matches Lookahead assertions do not consume any characters in the text. As a result, you can use them to find overla ...
chr = ' NORMEST Estimate the matrix 2-norm. NORMEST(S' Merely searching for non-vowels ([^aeiou]) does not return the expected a ...
(?=test)expr or (?!test)expr See Also regexp | regexpi | regexprep More About “Regular Expressions” on page 2-41 2 Program Com ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf