Programming | ![]() ![]() |
Operator Summary
MATLAB provides these operators for working with regular expressions:
Operator |
Usage |
(expr) |
Capture in a token all characters matched by the expression within the parentheses. |
\N |
Match the N th token generated by this command. That is, use \1 to match the first token, \2 to match the second, and so on. |
$N |
Insert the match for the N th token in a replacement string. Used only by the regexprep function. |
(?<name>expr) |
Capture in a token all characters matched by the expression within the parentheses. Assign a name to the token. |
\k<name> |
Match the token referred to by name . |
(?(tok)expr) |
If token tok is generated, then match expression expr . |
(?(tok)expr1| expr2) |
If token tok is generated, then match expression expr 1. Otherwise, match expression expr 2. |
![]() | Handling Multiple Strings | Comma-Separated Lists | ![]() |
© 1994-2005 The MathWorks, Inc.