Difference between revisions of "Pattern Match '?' Use"
From VistApedia
Line 32: | Line 32: | ||
# <-- e.g. "5" | # <-- e.g. "5" | ||
#.# <-- e.g. "5.10" means 5-10 | #.# <-- e.g. "5.10" means 5-10 | ||
− | . <-- means 0 | + | The default for the first # is 0 |
+ | The default for the second # is infinity | ||
+ | THEREFORE: | ||
+ | . <-- means [0 to infinity] (i.e. ANY NUMBER, including NONE) | ||
#. <-- e.g. "5." means any number >= 5 | #. <-- e.g. "5." means any number >= 5 | ||
.# <-- e.g. ".5" means any number <= 5 | .# <-- e.g. ".5" means any number <= 5 |
Revision as of 17:02, 21 October 2006
Use of the pattern match '?' character
The general syntax is: (MyVar?pattern)=TRUE/FALSE
"Pattern" is typically in this format:
#code#code#code...
For example:
3N1"-"2N1"-"4N would match for NNN-NN-NNNN 3N <--- 2 numbers 1"-" <--- 1 hyphen 2N <--- 2 numbers 1"-" <--- 1 hyphen 4N <--- 2 numbers
Available codes are:
N -- digits 0-9 A -- all upper or lowercase alphabetic characters P -- punctuation characters C -- ASCII controll characters E -- the entire ASCII character set U -- upper case characters L -- lowercase characters "xxx" -- must match characters in quotes (1 or more characters) 1995 M standards allow the following code options: (1"*",1"^") <-- i.e. 1 '*' OR 1 "^" e.g. 3N1(1"-",1"/")2N1(1"-",1"/")4N would match for NNN-NN-NNNN OR NNN/NN/NNNN
For the numbers portion of the syntax, the following is available:
# <-- e.g. "5" #.# <-- e.g. "5.10" means 5-10 The default for the first # is 0 The default for the second # is infinity THEREFORE: . <-- means [0 to infinity] (i.e. ANY NUMBER, including NONE) #. <-- e.g. "5." means any number >= 5 .# <-- e.g. ".5" means any number <= 5