Comments
Regular expressions can be complicated and cryptic to say the least. To help alleviate this, most regular expression engines support comments to be inserted within a regular expression.
To insert comments into regular expressions, use the following syntax:
(?#comment)
Parameter | Description |
---|---|
comment | Specifies any text desired as long as it does not contain a ')' |
When processing comments, the regex engine ignores everything after the (?#
until it finds the first closing parenthesis ')'.
Examples
[a-z](?#Only match lower case)
Supported by:
.NET, PCRE, Perl, Python, Ruby