Function |
Description |
---|---|
Compares case-sensitive values that are similar, using the UNIX file globbing syntax for its wildcards |
|
Compares values case insensitive |
|
Returns true if a given string matches a regular expression |
Compares case-sensitive values that are similar, using the UNIX file globbing syntax for its wildcards.
bool uGlob(pattern, text)
A string describing a match pattern
A string to investigate
Compare values using UNIX file globbing syntax:
uGlob("Mr. *", "Mr. Smith") // returns 1, indicating a match
uGlob("Mr. *", "Mrs. Clarke") // returns 0
Globbing rules:
“*” – matches any sequence of zero or more characters.
“?” – matches exactly one character. [^...] – matches one character not in the enclosed list.
[...] – matches one character from the enclosed list of characters.
With [...] and [^...] matching, a closing square bracket ( ] ) can be included in the list by making it the first character after an opening square bracket ( [ ) or a caret ( ^ ). Specify a range of characters using a hyphen ( - ):
“[a-z]” matches any single lowercase letter. To match a hyphen ( - ), make it the last character in the list.
To match an asterisk ( * ) or a question mark ( ? ), place them in square brackets ( [] ).
For example: abc[*]xyz, matches the literal value “abc*xyz” .
Compares values case insensitive.
The uLike function performs a pattern-matching comparison. The first parameter contains the pattern, the second parameter contains the string to match against the pattern. A percent symbol ( % ) in the pattern matches any sequence of zero or more characters in the string. An underscore ( _ ) in the pattern matches any single character in the string. Any other character matches itself or its lowercase or uppercase equivalent.
Currently, uLike only interpret only
uppercase and lowercase for 7-bit Latin characters, which means uLike is
case-sensitive for 8-bit ISO8859 characters or UTF-8 characters.
For example:
uLike('a' ,'A')
returns
1.
uLike('æ' ,'Æ')
returns
0.
number uLike(pattern, text)
A string describing a match pattern
A string to investigate
Compare values using pattern matching:
uLike("% happy %", "A happy man.") // returns 1
uLike("% happy %", "A sad man.") // returns 0
Returns true if a given string matches a regular expression.
number uMatches(text, regexpr)
Text to investigate
Regular expression specification
Check if a string could be interpreted as a floating point number:
uMatches("abc","[-+]?[0-9]*\\.?[0-9]*") // returns 0
uMatches("1.23","[-+]?[0-9]*\\.?[0-9]*") // returns 1