# p (pattern match) processing code

The p processing code tests a value
and determines if it matches a predetermined pattern matchstring composed
of alphabetic, numeric, or literal characters.

| System Processors | Update |
| --- | --- |
| Code Type | File Defining |
| Dictionary Attributes | Input Conversion |

## Syntax

```
p(matchstring){;(matchstring...)}
```

## Parameter(s)

| pattern.mask | Pattern of literal characters and codes (below) that must exactly match the data. A pattern mask is one of these characters (n, a, or x) preceded by a number to indicate the number of characters for that value. The mask must be enclosed in parentheses. There may be more than one pattern code, separated by semicolons. As long as the value matches at least one of the pattern codes, the test is a success. |
| --- | --- |
| mn | Test for m numeric characters (0-9). The characters + - , . are not considered numeric here. |
| ma | Test for m alphabetic characters (A-Z and a-z). |
| mx | Test for any m characters except spaces. |
| string | Test to match a literal string. If this is used in combination with the patterns above, enclose the string in double quotes. If m is zero, the system tests for all characters to match the specified type. |

## Description

The p processing
code may be used as an output-conversion (attribute 7) or input-conversion
(attribute 14). As an input-conversion, the p code
verifies input. Multiple pattern matchstrings must be separated by
semicolons.

In all of the above cases that support a number,
the exact number must be met or found to accept the data. Zero as
the number allows for any number, including 0, to be accepted.

Multiple *matchstring* parameters will accept
the data if any of the matchstrings are met. If the data matches the
pattern exactly, the data is returned. If the data does not match,
null is returned.

## See also

- [Processing codes (Update processor)](https://d3codex.com/updateprocessor/processing-codes-update-processor/)
- [match relational operator](https://d3codex.com/pickbasic-flashbasic/match-relational-operator/)
- [Processing codes overview](https://d3codex.com/processingcodes/processing-codes-overview/)
- [u0070 user exit](https://d3codex.com/proc/u0070-user-exit/)

---
Source: https://d3codex.com/processingcodes/p-pattern-match-processing-code/ - part of the D3Codex reference.
