In A Tour of C++, on page 83, Stroustrup provides the following regular expression:
R"((\ew+))"
Nowhere in the book is \e defined, and I can't find anything about it on the Internet. What does \e represent in a regular expression?
It's just a typo by Stroustrup. \e doesn't have any special meaning in regular expressions and doesn't make sense in the context.
If you were to actually compile the example code on the page using
R"((\ew+))"
wouldn't print anything at all. He probably just wanted to use
R"((\w+))"
a capture group of 1 or more word characters, which matches the shown output.
His original regex compiled
Compiled after removing the extra 'e'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With