![]() |
Home | Libraries | People | FAQ | More |
boost::xpressive::skip — Specify which characters to skip when matching a regex.
// In header: <boost/xpressive/regex_primitives.hpp> template<typename Skip> ( skip);
skip() instructs the regex engine to skip certain characters when matching a regex. It is most useful for writing regexes that ignore whitespace. For instance, the following specifies a regex that skips whitespace and punctuation:
// A sentence is one or more words separated by whitespace // and punctuation. sregex sregex
The way it works in the above example is to insert keep(*set[_s | punct]) before each primitive within the regex. A "primitive" includes terminals like strings, character sets and nested regexes. A final *set[_s | punct] is added to the end of the regex. The regex sentence specified above is equivalent to the following:
sregex
![]() |
Note |
|---|---|
Skipping does not affect how nested regexes are handled because they are treated atomically. String literals are also treated atomically; that is, no skipping is done within a string literal. So |
Parameters: |
|