ASL Glob Pattern Matches

From SMARTS-WIKI
Jump to: navigation, search

The ASL parsing language supports several methods of generic parsing, but sometimes you need to be able to match a particular (and perhaps complicated) glob pattern instead of using the build-in rules. This document describes some of the nuances of using the glob() function in ASL.

*	        Matches an arbitrary string of characters. The string can be empty.
?	        Matches any single character.
^	        Acts as a NOT. Use this in conjunction with other symbols or characters.
[set]	        Matches any single character that appears within [set]; or, if the first
[c1-c2]	character of [set] is (^), any single character that is not in the set.
                A hyphen (-) within [set] indicates a range, so that [a-d] is equivalent to [abcd].
                The character before the hyphen (-) must precede the character after it or the range
                will be empty.
                The character (^) in any position except the first, or a hyphen (-) at the first or
                last position, has no special meaning.
<n1-n2>	Matches numbers in a given range. Both n1 and n2 must be strings of
                digits, which represent non-negative integer values. The matching
                characters are a non-empty string of digits whose value, as a
                nonnegative integer, is greater than or equal to n1 and less than or
                equal to n2. If either end of the range is omitted, no limitation is
                placed on the accepted number.
|	        Matches alternatives. For example, ”ab|bc|cd” without spaces matches 
                exactly the three following strings: “ab”, “bc”, and “cd”. A vertical
                bar (|) as the first or last character of a pattern accepts an empty 
                string as a match.
\	        Removes the special status, if any, of the following character. 
                Backslash (\) has no special meaning within a set ([set]) or range
                (<n1-n2>) construct.
&	        “And Also” for a compound wildcard pattern. If a component basic
                wildcard pattern is preceded by & (or is the first basic wildcard
                pattern in the compound wildcard pattern), it must successfully match.
~	        “Except” for a compound wildcard pattern (opposite function of &).
                If a component basic wildcard pattern is preceded by ~, it must not
                match.

NOTE: Spaces are interpreted as characters and are subject to matching even if they are adjacent to operators like “&.”

NOTE: All (, ), [, ], <, or > must be escaped by preceding the char with two backslashes. To recognize "(A)" the pattern must be "\\(A\\)".

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox