简体   繁体   中英

Regex options for std::regex

I was looking for a way of switching between multiline/singleline regex so that the $ means the end of input/the end of line. I've looked through different guides and they point to some OPTIONS for this. However, I can't find any such options for std::basic_regex in http://www.cplusplus.com/reference/regex/basic_regex/basic_regex/ . I've came across a recommendation to use (s) (or something like) in the beginnning of a regex but it causes an exception.

Are there a list of any additional options which can be passed to a std::regex in addition to flags that can be passed to basic_regex constructor?

Your (?s) flag is not yet supported by C++.

But you can still do a multiline regex match.

To match everything on a single line use: .*

To match everything on multiple lines use: (?:.|\\n)*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM