Boost C++ Libraries: Ticket #5215: regex_match is giving a performance hit. https://svn.boost.org/trac10/ticket/5215 <p> inline bool regex_match(const std::string&amp; s, </p> <blockquote> <p> const regex&amp; e, match_flag_type flags = match_default) </p> </blockquote> <p> When an expression like /Volumes/.*/Backups.backupdb/.* is passed to regex_match() then I am experiencing a performance hit. I am using boost library version 1.32.0 (Since this version was not available in the drop down I have selected 1.34.0) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5215 Trac 1.4.3 anonymous Fri, 25 Feb 2011 05:38:13 GMT version changed https://svn.boost.org/trac10/ticket/5215#comment:1 https://svn.boost.org/trac10/ticket/5215#comment:1 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.34.0</span> → <span class="trac-field-new">Boost 1.46.0</span> </li> </ul> Ticket anonymous Mon, 28 Feb 2011 09:42:42 GMT <link>https://svn.boost.org/trac10/ticket/5215#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5215#comment:2</guid> <description> <p> Can you please provide some example code that illustrates the problem? </p> <p> Please also bare in mind that matching a regular expression is in the general case NP-complete. Assuming it doesn't change the semantics of your program then something like: </p> <p> <code>/Volumes/[^/]*/Backups.backupdb/.*</code> </p> <p> Should be more efficient. Otherwise try something like: </p> <p> <code>/Volumes(?:/[^/]*)+?/Backups.backupdb/.*</code> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 01 Mar 2011 09:32:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5215#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5215#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/5215#comment:2" title="Comment 2">anonymous</a>: </p> <blockquote class="citation"> <p> Can you please provide some example code that illustrates the problem? </p> <p> Please also bare in mind that matching a regular expression is in the general case NP-complete. Assuming it doesn't change the semantics of your program then something like: </p> <p> <code>/Volumes/[^/]*/Backups.backupdb/.*</code> </p> <p> Should be more efficient. Otherwise try something like: </p> <p> <code>/Volumes(?:/[^/]*)+?/Backups.backupdb/.*</code> </p> </blockquote> <p> Thanks for the reply. </p> <p> After I posted this issue, I was trying out different alternatives and found something. The back drop for this issue is that, I am getting exclusion list from the User, based on which I am performing some operations. So I convert the exclusion list to an 'expression' and pass it to regex_match(). The more I add exclusion's , more time is taken by regex_match(). As suggested by I would provide an example code that would illustrate the problem. </p> <p> Thanks. </p> <p> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sat, 07 Jul 2012 18:10:34 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5215#comment:4 https://svn.boost.org/trac10/ticket/5215#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Closed pending update from user. </p> Ticket