MATLAB Function Reference    
regexpi

Match regular expression, ignoring case

Syntax

Description

start = regexpi(str,expr) returns a row vector, start, containing the indices of the substrings in str that match the regular expression string, expr, regardless of case.

When either str or expr is a cell array of strings, regexpi returns an m-by-n cell array of row vectors of indices, where m is the the number of strings in str and n is the number of regular expression patterns in expr.

[start,finish] = regexpi(str,expr) returns an additional row vector finish, that contains the indices of the last character of the corresponding substrings in start.

[start,finish,tokens] = regexpi(str,expr) returns a 1-by-n cell array, tokens, of beginining and ending indices of tokens within the corresponding substrings in start and finish. Tokens are denoted by parentheses in the expression, expr.

[...] = regexpi(str,expr,'once') finds just the first match. (By default, regexp returns all matches.) If no matches are found, then all return values are empty.

Remarks

See Regular Expressions, in the MATLAB documentation, for a listing of all regular expression metacharacters supported by MATLAB.

regexpi does not support international character sets.

Examples

Return a row vector of indices that match words that start with m and end with y, regardless of case:

See Also

regexp, regexprep, strfind, findstr, strmatch, strcmp, strcmpi, strncmp, strncmpi


  regexp regexprep