Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Options for Perl Regular Expressions

One of the following must always be set for perl regular expressions:

Element

Standardized

Effect when set

ECMAScript

Yes

Specifies that the grammar recognized by the regular expression engine uses its normal semantics: that is the same as that given in the ECMA-262, ECMAScript Language Specification, Chapter 15 part 10, RegExp (Regular Expression) Objects (FWD.1).

This is functionally identical to the Perl regular expression syntax.

Boost.Regex also recognizes all of the perl-compatible (?...) extensions in this mode.

perl

No

As above.

normal

No

As above.

JavaScript

No

As above.

JScript

No

As above.

The following options may also be set when using perl-style regular expressions:

Element

Standardized

Effect when set

icase

Yes

Specifies that matching of regular expressions against a character container sequence shall be performed without regard to case.

nosubs

Yes

Specifies that when a regular expression is matched against a character container sequence, then no sub-expression matches are to be stored in the supplied match_results structure.

optimize

Yes

Specifies that the regular expression engine should pay more attention to the speed with which regular expressions are matched, and less to the speed with which regular expression objects are constructed. Otherwise it has no detectable effect on the program output. This currently has no effect for Boost.Regex.

collate

Yes

Specifies that character ranges of the form [a-b] should be locale sensitive.

newline_alt

No

Specifies that the \n character has the same effect as the alternation operator |. Allows newline separated lists to be used as a list of alternatives.

no_except

No

Prevents basic_regex from throwing an exception when an invalid expression is encountered.

no_mod_m

No

Normally Boost.Regex behaves as if the Perl m-modifier is on: so the assertions ^ and $ match after and before embedded newlines respectively, setting this flags is equivalent to prefixing the expression with (?-m).

no_mod_s

No

Normally whether Boost.Regex will match "." against a newline character is determined by the match flag match_dot_not_newline. Specifying this flag is equivalent to prefixing the expression with (?-s) and therefore causes "." not to match a newline character regardless of whether match_not_dot_newline is set in the match flags.

mod_s

No

Normally whether Boost.Regex will match "." against a newline character is determined by the match flag match_dot_not_newline. Specifying this flag is equivalent to prefixing the expression with (?s) and therefore causes "." to match a newline character regardless of whether match_not_dot_newline is set in the match flags.

mod_x

No

Turns on the perl x-modifier: causes unescaped whitespace in the expression to be ignored.

no_empty_expressions

No

When set then empty expressions/alternatives are prohibited.

save_subexpression_location

No

When set then the locations of individual sub-expressions within the original regular expression string can be accessed via the subexpression() member function of basic_regex.


PrevUpHomeNext