Pattern Matching Conversion (P)

Pattern Matching Conversion (P)

Top  Previous  Next

 

The P conversion code attempts to match the supplied data against one or more pattern templates

 

The full format of this conversion code is

 

P(template){;(template)...}

 

where

 

templateis a pattern template as for the MATCHES operator and must be enclosed in brackets. If more than one template is supplied, they may be separated by semicolons (;) or forward slashes (/).

 

 

The P conversion code tests whether the input data matches template. If a match is found, the original data is returned. If no match is found, a null string is returned.

 

If more than one template is provided, the input value is tested against each in turn.

 

A null input value always returns a null result.

 

 

Examples

 

Conversion

Data

Result

P(3A)

123

 

P(3A)

ABC

ABC

P(1-2N)

74

74

P(1-2N)

123

 

P(2A);(3N)

12

 

P(2A);(3N)

AB

AB

P(2A);(3N)

123

123

P(2A)