There is a function to use pattern matching (using regular expressions) in C++?

前端 未结 4 507
说谎
说谎 2020-12-21 15:02

There is a simple C++ method to use pattern matching on strings? The code should sound like this:

if (regexpcmp(\"l?nole*[0-9]\", \"linoleum1\")) {
  //we ha         


        
4条回答
  •  执笔经年
    2020-12-21 15:47

    Not in the core language. Use Boost.Regex or an external library like pcre. In a unix environment you almost certainly have access to the BSD regular expression tools (regcomp, regerror, regexec, regfree) which are c-like rather than c++-like but do work.

提交回复
热议问题