开发者

issues matching number in string with boost regex

I'm trying to determine whether or not a string contains a number. This doesn't seem to be working.

static const regex re("([0-9]+)");
cout << regex_match("L5开发者_开发问答", re);

prints

0

Thanks!!


From the boost docs on regex_match:

Note that the result is true only if the expression matches the whole of the input sequence. If you want to search for an expression somewhere within the sequence then use regex_search.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜