next up previous
Next: Handling of blanks Up: General Syntax Previous: Units


Strings

String matching can be done in three ways. Any component of a comma separated list that cannot be parsed as number/number range/physical quantity is treated as a regular expression or a literal string. If the string does not contain the characters '*', '', '' or '?', it is treated as a literal string and used for exact matching. If any of the above mentioned characters are part of the string, it is used as a regular expression. As a result, for most cases, the user does not need to supply any special delimiters for literal strings and/or regular expressions. However if it is required that the string be matched exclusively as a regular expression, it can be supplied within a pair of '/' as delimiters. A string enclosed within double quotes ('"') is used exclusively for pattern matching (patterns are a simplified form of regular expressions - used in most UNIX commands for string matching). Patterns are internally converted to equivalent regular expressions before matching. Read elsewhere (e.g. use command "info regex", or visit this link) for details of regular expression and patterns.

Strings can include any character except the following:

   ','   ';' '"'  '/'  ':' and NEWLINE
(these are reserved characters for MSSelection expression syntax). Strings that do not contain any of the characters used to construct regular expressions or patterns are used for exact matches. Although it is highly discouraged to have name in the database containing the above mentioned reserved characters, if one DOES choose to include the reserved characters are part of names etc., those names can only be matched against quoted strings (since regular expression and patterns are super-set of literal strings. I.e. literal string is a valid regular expression also). This leaves the list '"', '*', '?', '' and '' as the list of printable character that cannot be part of a name (i.e., a name containing this character can never be matched in a MSSelection expression). If a need is felt to include these as well, an escape mechanism can be included later (but I would prefer to enforce that at least these characters not be part of any name!). Following are some examples of strings/regular expressions/patterns:


next up previous
Next: Handling of blanks Up: General Syntax Previous: Units
Sanjay Bhatnagar 2012-11-26