P Code - Pattern Matching
The P code returns a value if it matches one of the specified patterns. Patterns can be combinations of numeric and alphabetic characters and literal strings.
If the value does not match any of the patterns, the processor returns null.
Input Conversion
Input conversion does not invert. It simply applies the pattern matching to the input data.
Syntax
P(element){;(element)}...
Syntax Elements
element is one or more of the following forms:
nNtests for n numeric characters.
nAtests for n alphabetic characters.
nXtests for n characters.
'literal'tests for the presence of the literal.
Note
When n is 0 (zero), element tests for any number of the specified characters.
Example of Single Pattern
The code P(3N'-'2N'-'4N) tests for data that has three numerics, a hyphen, two numerics, a hyphen, and four numerics. The processor returns data that matches this pattern exactly:
Data |
Result |
---|---|
123-45-6789 |
123-45-6789 |
ABC456 |
|
ASD-34-4567 |
|
123-45-67890 |
|
783-49-7263 |
783-49-7263 |
W3-45-67J3 |
|
Example of Multiple Patterns
The following tests for one of three patterns: P(1N3A3N);(3A3N);(3N3A). The processor returns any value that matches any one of these patterns:
Data |
Result |
---|---|
ABCDEFGHIJKLMNO |
|
1ABC234 |
1ABC234 |
ABC456 |
ABC456 |
0987654321 |
|
123VBN |
123VBN |
WDV648 |
WDV648 |
3EDC000 |
3EDC000 |
471CIS |
471CIS |
76TYHIU6T |
|
1A2B3C4D |
|
6KJS947 |
6KJS947 |