You can redefine the delimiters by assigning a string to the built-in variable delim. Use the following syntax to define new delimiters:
delim=<string>;
The <string> defines the set of characters to use as delimiters.
The delimiter is specified at the beginning of a script or at the beginning of a rule, before any pattern matching.
-
If a delimiter statement is placed before all of the rules, the delimiters apply to all rules.
-
If a delimiter statement is placed in a rule, ASL overrides any previous delimiter definitions.
In this example, the delimiter is ":?" for RULE2, but "|" for RULE1 and RULE3.
delim=":?"; START { RULE1 RULE2 } RULE1 { delim="|"; RULE3 }
The new delimiters override all of the default delimiters except for eol and fs. Each character included in the <string> is a separate delimiter.
delim = ":?";
When the string :? is assigned to delim, it defines two delimiters: a colon and a question mark. If input data contained the combination (“:?”), ASL interprets the data as two delimiters in series.
The match for some characters requires a special syntax. To use tabs and returns as delimiters, use the special syntax within the quotation marks, as described in GUID-F0CF2B17-5935-4B1C-9EC4-0323E256476D.html#GUID-F0CF2B17-5935-4B1C-9EC4-0323E256476D___PATTERNS_53250.
Note:For most cases, use the eol pattern match instead of line feed or carriage return. The eol character is a delimiter by default and cannot be overridden.
An alternative to using the delim variable is to use a combination of the rep() function and the notany() function. For example:
x:rep(notany(":?"))
In the example, ASL assigns to the variable x everything that appears up to a question mark or a colon.