Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

pattern

1977 Version of ANSI Standard

3.3.3 Pattern Match

The pattern match operator ? tests the form of the string which is its left-hand operand. S ? P is true if and only if S is a member of the class of strings specified by the pattern P.

A pattern is a concatenated list of pattern atoms.

    pattern::=

patatom [ patatom ] ...
@ expratom V pattern


See also the transition diagram for pattern.

Assume that pattern has n patatoms. S ? pattern is true if and only if there exists a partition of S into n substrings

S = S1 S2 ... Sn

such that there is a one-to-one order-preserving correspondence between the Si and the pattern atoms, and each Si "satisfies" its respective pattern atom. Note that some of the Si may be empty.

Each pattern atom consists of a pattern code patcode or a string literal strlit, preceded either by an integer literal intlit multiplier or by the indefinite multiplier ".".

    patatom::=

intlit
.




strlit
patcode


See also the transition diagram for patatom.

    patcode::=






C
N
P
A
L
U
E







...

See also the transition diagram for patcode.

Each patcode is satisfied by any single character in the union of the classes of characters represented, each class denoted by its own patcode letter, as follows.

 C  33 Control characters, including DEL
N 10 Numeric characters
P 33 Punctuation characters, including SP
A 52 Alphabetic characters
L 26 Lower-case alphabetic characters
U 26 Upper-case alphabetic characters
E Everything (the Entire set of characters)

The strlit is satisfied by, and only by, the value of strlit.

If the indefinite multiplier "." is present, patatom is satisfied by a concatenation of any number of strings (including none), each of which satisfies the patcode or strlit following the multiplier.

If the intlit multiplier is present, patatom is satisfied by a concatenation of exactly intlit strings, each of which satisfies the patcode or strlit following the multiplier. In particular, if the value of intlit is zero, the corresponding Si is empty.

The dual operator '? is defined by: A '? B = '(A ? B)

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.

This page most recently updated on 15-Nov-2023, 13:19:37.

For comments, contact Ed de Moel (demoel@jacquardsystems.com)