next up previous contents index
Next: Token List Up: Command Format Previous: Variable Names   Contents   Index


Regular Expressions

Some commands allow selection of items via a regular-expression. Such a pattern string must be enclosed in single or double quotes; and the case of letters is significant. The meaning of special characters follows the standard UNIX usage: utility:
.
Stands for a single arbitrary character,
[letter...letter]
Stands for a single character occurring in the bracketed string, Example: ``[abc]'' denotes the choice of one of a,b,c.
[character-character]
Stands for a single character from a range of characters, Example: ``[a-zA-Z]'' denotes the choice of any letter.
*
Allows zero or more repetitions of the preceding item, Example: ``[A-Z]*'' denotes a string of zero or more upper case letters.
$\backslash$character
Removes the special meaning of character, Example: ``$\backslash$*'' denotes a literal asterisk.
All other characters stand for themselves. The pattern

"[A-Za-z][A-Za-z0-9_']*"
illustrates all possible unquoted identifier formats. Since identifiers are converted to lower case, after reading they will match the pattern

"[a-z][a-z0-9_']*"
Examples for pattern use:

SELECT,PATTERN="D.."
SAVE,PATTERN="K.*QD.*\.R1"
The first command selects all elements whose names have exactly three characters and begin with the letter D. The second command saves definitions beginning with the letter K, containing the string QD, and ending with the string .R1. The two occurrences of .* each stand for an arbitrary number (including zero) of any character, and the occurrence \. stands for a literal period.


next up previous contents index
Next: Token List Up: Command Format Previous: Variable Names   Contents   Index
MAD User Guide, http://wwwslap.cern.ch/mad/