Unsolved
This post is more than 5 years old
1 Message
0
919
August 15th, 2012 07:00
How can I escape "<" and ">" in a glob asl expression
I'm trying to execute the following ASL command: if (glob("*\<[0-9a-fA-F]\>*", EVENTNAME))
But I get the following error:
[15-Aug-2012 10:47:28 AM+438ms EDT] t@-173790320 main
ASL-W-ERROR_RULE_SOURCE-While executing rule set '/tmp/change_eventname.asl'
ASL-ERROR_ACTION-While executing action at:
ASL-CALL_STACK_RULE- RuleName: START, Line: 36
ASL-BAD_GLOB-Illegal argument '*<[0-9a-fA-F]>*' to glob function
How can I escape the <> characters such that I can use them in the glob statement as a string rather than a parameter?
Thank you
No Events found!
bkuhhirte
52 Posts
0
August 29th, 2012 17:00
From my file "secrets of the ASL Glob Universe":
#~ aslGlobPatternSummary.txt - ASL glob() PATTERN OPERATOR DESCRIPTION
#
# Copyright (c) 2004 System Management ARTS (SMARTS)
# All Rights Reserved
#
# RCS $Id: $
# $Source: $
#
________________________________________________________________________________
* 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.
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
( ) 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\\)".