Tests if string matches a pattern.
* matches any sequence of characters (including empty).
@ matches one or more characters, excluding uppercase letters.
Exact match:
$ wo 'StringMatchQ["hello", "hello"]'
True
$ wo 'StringMatchQ["hello", "world"]'
False
$ wo 'StringMatchQ["hello", "Hello"]'
False
Wildcard * matches any sequence:
$ wo 'StringMatchQ["hello", "h*o"]'
True
$ wo 'StringMatchQ["hello", "h*"]'
True
$ wo 'StringMatchQ["hello", "*o"]'
True
$ wo 'StringMatchQ["hello", "*"]'
True
$ wo 'StringMatchQ["hello", "h*l*o"]'
True
$ wo 'StringMatchQ["hello", "*ell*"]'
True
* can match empty sequence:
$ wo 'StringMatchQ["hello", "hello*"]'
True
$ wo 'StringMatchQ["hello", "*hello"]'
True
$ wo 'StringMatchQ["hello", "hel*lo"]'
True
Non-matching patterns:
$ wo 'StringMatchQ["hello", "h*x"]'
False
$ wo 'StringMatchQ["hello", "x*o"]'
False
$ wo 'StringMatchQ["hello", "hellooo"]'
False
Empty string cases:
$ wo 'StringMatchQ["", ""]'
True
$ wo 'StringMatchQ["", "*"]'
True
$ wo 'StringMatchQ["", "a"]'
False
$ wo 'StringMatchQ["hello", ""]'
False
Wildcard @ matches one or more non-uppercase characters:
$ wo 'StringMatchQ["hello", "h@o"]'
True
$ wo 'StringMatchQ["hello", "@"]'
True
$ wo 'StringMatchQ["hello", "h@"]'
True
$ wo 'StringMatchQ["hello", "@o"]'
True
@ requires at least one character (unlike *):
$ wo 'StringMatchQ["hello", "hello@"]'
False
$ wo 'StringMatchQ["", "@"]'
False
@ does not match uppercase letters:
$ wo 'StringMatchQ["hEllo", "h@o"]'
False
$ wo 'StringMatchQ["HELLO", "@"]'
False
$ wo 'StringMatchQ["helloWorld", "hello@"]'
False
@ matches lowercase, digits, and other non-uppercase characters: