Boost C++ Libraries: Ticket #195: regex_match problem https://svn.boost.org/trac10/ticket/195 <pre class="wiki">Ruslan Talpa &lt;tristan@pisem.net&gt; I want to match different strings in a whois result and i am having some problems. first a execut a shell command similar to: "/usr/bin/whois domain.com &gt; tmp_file" so after this we have a file, from wich i read line by line and try to match some strings but no matter what the reg. expression is the regex_match returns false. i even tried "regex expression("a");" and still no luck The only thing i can think of is that there is some character encoding stuff envolved but i don't know what to do. Please help, tell me what i am doin wrong here are the functions involved int parse_line(const char* response) { regex expression("a"); cmatch what; if(regex_match(response, what, expression)) { cout &lt;&lt; "MATCH\n"; } else { cout &lt;&lt; "NO MATCH\n"; } return 0; } int get_info(string domain, char* pipe_file) { string line; Message msg; strstream command; command &lt;&lt; "/usr/bin/whois " &lt;&lt; domain.c_str() &lt;&lt; " &gt; " &lt;&lt; pipe_file; system(command.str()); ifstream f(pipe_file); while (!f.eof()) { getline(f, line); parse_line(line.c_str()); } f.close(); return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/195 Trac 1.4.3 nobody Wed, 27 Aug 2003 12:49:57 GMT <link>https://svn.boost.org/trac10/ticket/195#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/195#comment:1</guid> <description> <pre class="wiki">Logged In: NO You're using regex_match when you should be using regex_search. regex_match requires that the whole of the string matches the regex whereas regex_search requires that some part of it matches. regards aitor </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>bjorn_karlsson</dc:creator> <pubDate>Wed, 27 Aug 2003 13:54:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/195#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/195#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=536454 The problem is that you're using the wrong algorithm - regex_match only returns true on an exact match, i.e. in your example, the input string would need to be exactly "a" to be a match. What you probably want is to use the algorithm regex_search. By the way, we normally answer this type of questions on the Boost-Users mailing list (http://groups.yahoo.com/group/Boost-Users/). See the Boost homepage (www.boost.org) for more details. Hope this helps, Bjorn Karlsson bjorn_karlsson@acm.org </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>bjorn_karlsson</dc:creator> <pubDate>Wed, 27 Aug 2003 13:56:15 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/195#comment:3 https://svn.boost.org/trac10/ticket/195#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket