title: C++ regex search specific chinese pattern
body: <p>I need to regex search specific chinese pattern from C++ string
  For example I have a source string &quot;什么手机好&quot; and a pattern &quot;什么(.*)好&quot;</p>
  <p>I use boost::regex_search and wstring to do this , but there is something wrong
  when the search string has english or number, the code doesn't work, for example , source string is &quot;abc什么efg手机好&quot; pattern is &quot;什么(.*)好&quot;, the code do ACT2. And  source string is &quot;&quot; (empty string) pattern is &quot;什么(.*)好&quot; , the code do ACT1</p>
  <p>I want to know how to fix it.</p>
  <p>func</p>
  <pre><code>std::wstring string2wstring(const std::string&amp; s) {
       setlocale(LC_CTYPE, &quot;&quot;);
       int iWLen = std::mbstowcs(NULL, s.c_str(), s.length());
       wchar_t *lpwsz= new wchar_t[iWLen + 1];
       std::mbstowcs(lpwsz, s.c_str(), s.length());
       std::wstring wstrResult(lpwsz);
       delete []lpwsz;
       return wstrResult;
  }
  
  std::wstring ws = string2wstring(s);
  boost::wregex wpattern(string2wstring(pattern));
  if (boost::regex_search(ws, wpattern) == true) {
     do ACT1;
  } else {
     do ACT2;
  }
  </code></pre>