Previous topic

strlower

Next topic

strmatchi

This Page

strmatchΒΆ

strmatch checks if elements of a string matrix match a pattern.

rmBool = strmatch(ssPattern, smString)

Return Value

rmBool is real matrix. A matrix element of rmBool is True (1), if the corresponding string element of smString matches the pattern ssPattern, and False (0), if the corresponding element of smString does not match the pattern.

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 “\” must be used in front of the character.
smString

smString is a string matrix.

Example

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

* strmatch("*[a-z]*", ["Hallo", "HALLO"])
    1.0000       0.0000

Example

* strmatch("hello", "hello")
    1.0000
* strmatch("hello", "Hello")
    0.0000
* strmatch("[hH]ello", "Hello")
    1.0000
* strmatch("*ello", "Hello")
    1.0000
* strmatch("*el?o", "Hello")
    1.0000
* what("strm*")
strmatch
  1 function(s) defined
* what("str[!m]*")
strchar
strCharToOem
strcode
strempty
strfindreplace
strlen
strlower
strOemToChar
strsplit
strtod
strtofield
strtok
strtrim
strupper
  14 function(s) defined
* strmatch("*\*\*CHAN[0-9]\*\**", ["asdf**CHAN1**asdf", "asdf"])
    1.0000    0.0000

id-1415657