NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Regular Expression Options

A regular expression pattern can be modified by any of several options when created. Options are passed as a string of letters in a second argument to the Regular Expression("pattern","options") constructor, or by the (?imnsx-imnsx: ) or (?imnsx-imnsx) constructs.

An option is disabled by including it after a "-". For example, (?ix-ms) turns on "i" and "x" and turns off "m" and "s".

Supported options are listed below. Note that the options "r" and "c" apply only to an expression as a whole, and are not allowed inline. (They can only be specified as the second argument to Regular Expression.)

i Case-insensitive match.
m Multiline mode. Changes the meaning of ^ and $ so that they match at the beginning and end, respectively, of any line, not just the beginning and end of the whole string.
n Only captures explicitly named or numbered groups of the form (?<name>…). This allows naked parentheses to act as noncapturing groups without the syntactic clumsiness of the (?:…).
c Compiles. Generates IL code for the regular expression; yields faster execution at the expense of startup time.
s Single-line mode. Changes the meaning of dot (.) so that it matches every character (instead of every character except \n).
x Eliminates unescaped white space from the pattern and enables "#" comments. (Note that # comments are currently experimental.)
r Searches from right to left instead of from left to right. A regular expression compiled with this option will move to the left of the starting position instead of to the right. (Therefore, the starting position should be specified at the end of the string instead of the beginning.) This option cannot be specified in mid-stream. This prevents the possibility of crafting regular expressions with infinite loops. Nevertheless, the (?<) lookbehind constructs provide something similar that can be used as a subexpression.