Difference between revisions of "Pattern Match '?' Use"

From VistApedia
Jump to: navigation, search
Line 24: Line 24:
 
   "xxx" -- must match characters in quotes (1 or more characters)
 
   "xxx" -- must match characters in quotes (1 or more characters)
 
    
 
    
 +
Codes may be grouped.
 +
  e.g. 1UP  means 1 uppercase or punctuation
 +
      .LN  means any number of lowercase characters or numbers
 +
 
   1995 M standards allow the following code options:
 
   1995 M standards allow the following code options:
 
   (1"*",1"^")  <-- i.e. 1 '*' OR 1 "^"
 
   (1"*",1"^")  <-- i.e. 1 '*' OR 1 "^"

Revision as of 20:22, 27 August 2008

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   <--- 3 numbers
   1"-" <--- 1 hyphen
   2N   <--- 2 numbers
   1"-" <--- 1 hyphen
   4N   <--- 4 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)
 

Codes may be grouped.

 e.g. 1UP  means 1 uppercase or punctuation
      .LN  means any number of lowercase characters or numbers
 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