开发者

issues matching number in string with boost regex

开发者 https://www.devze.com 2023-01-09 13:24 出处:网络
I\'m trying to determine whether or not a string contains a number. This doesn\'t seem to be working.

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

精彩评论

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

关注公众号