strmatchi

strmatchi returns a vector of indices of those matrix elements which match the given pattern.

rvIndex = strmatchi(ssPattern, smString)

Return Value

rvIndex is real vector. The vector contains the element indices of those matrix elements which match the given pattern. If no element is found the function returns the value 0.

Parameters

ssPattern

ssPattern is a scalar string containing a pattern.

Value Meaning
* Match zero or more characters.
? Match any single character.
[SET] Match the list of characters.
[!SET] or [^SET] Match all characters except those specified in the list. For example, the pattern [aAbB] or [0-9A-Z] will match the numbers 0 to 9 and all upper case alphabetic characters. If any of the characters []*?!^-are used in [SET], a double backslash “"
smString

smString is a string matrix.

Comment

A set is composed of characters or ranges; a range looks like character hyphen character (as in 0-9 or A-Z). [0-9a-zA-Z_] is the minimal set of characters allowed in the [..] pattern construct.

To suppress the special syntactic significance of any of []*?!^-\, and match the character exactly, precede it with a \\.

Example

The following example shows how to find out if a string contains small letters.

* strmatchi("*[a-z]*", ["Hello", "HELLO", "HEllo"])
    1.0000       3.0000

id-447035