开发者

How would you approach string wildcards, without just comparing the correct values?

开发者 https://www.devze.com 2023-02-28 20:53 出处:网络
It has come to my attention that there is no standard form of regular expressions for C++. Although there are many ways for you to check for matching values, what happens when you need complicated for

It has come to my attention that there is no standard form of regular expressions for C++. Although there are many ways for you to check for matching values, what happens when you need complicated formula to compare one value to another, wi开发者_如何学Pythonthout dozens of lines just for nested IF clauses, or extremely long OR statements?

In short, how would you approach regular expressions style comparisons with C++?

EDIT: Without external libraries, I'm a bit of a newbie.


You need look no further than Boost.Regex, or in some modern compilers and libraries, std::tr1::regex.

You may also want to consider using Perl-Compatible Regular Expressions library, PCRE.

EDIT: your clarification of the question to require not using any external libraries, ultimately increases the amount of work you'll be doing. Here is Rob Pike's regex matching code, which may be a good start for your efforts.


In short, Boost.Regex or std::tr1::regex.


Check out http://www.pcre.org/.

0

精彩评论

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

关注公众号