Questions about the regular expression contains spaces

C ++ to do a project, use regular expressions when I want to express all digital, I set the variable like this:

regex reg("^[1-9][0-9] * $");

Not always determined by the time.

By chance behind the box to remove the inter-symbol, we get the results I want:

regex reg("^[1-9][0-9]*$");

 

In order to remind ourselves that the space will compile the regular expression, not just add a space.

Space can \ s representation

In addition, look for this error, I got most of the language platforms are not the '\' as an escape character. To be written in '\\ s' to the '\' escape

 

Guess you like

Origin www.cnblogs.com/JCS-DOC/p/11544598.html