开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜