regexpi

Case-insensitive version of regexp.

Category: Language Fundamentals > Data Types

Syntax

out = regexpi(str, expr, outkey)

Same as regexp with the 'ignorecase' option on.

Description

regexpi(str, expr) is shorthand for regexp(str, expr, 'ignorecase'). All options and outputs of regexp are available. Case sensitivity can also be turned back on inside the expression with (?-i).

Input arguments

str, expr, outkey
Same arguments as in regexp.

Output arguments

out
Same outputs as regexp.

Example

regexpi('ABC', 'b', 'match')
regexpi('Hello', '^h', 'match')
regexpi('ABC', 'b')
Output
ans = 1×1 cell

    {'B'}
ans = 1×1 cell

    {'H'}
ans = 2

See also

regexp regexprep strfind contains