Using regex lookbehinds in C++11

前端 未结 1 1710
北恋
北恋 2020-11-30 11:21

Why can\'t I use lookbehinds in C++11? Lookahead works fine.

std::regex e(\"(?<=a)b\");

This will throw the following exception:

相关标签:
1条回答
  • 2020-11-30 11:47

    C++11 <regex> uses ECMAScript's (ECMA-262) regex syntax, so it will not have look-behind (other flavors of regex that C++11 supports also doesn't have look-behind).

    If your use case requires the use of look-behind, you may consider using Boost.Regex instead.

    0 讨论(0)
提交回复
热议问题