Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72777 - sandbox/tools/auto_index/src
From: john_at_[hidden]
Date: 2011-06-27 13:19:22


Author: johnmaddock
Date: 2011-06-27 13:19:21 EDT (Mon, 27 Jun 2011)
New Revision: 72777
URL: http://svn.boost.org/trac/boost/changeset/72777

Log:
Fix regular expression generator to escape special characters.
Text files modified:
   sandbox/tools/auto_index/src/index_generator.cpp | 6 +++---
   1 files changed, 3 insertions(+), 3 deletions(-)

Modified: sandbox/tools/auto_index/src/index_generator.cpp
==============================================================================
--- sandbox/tools/auto_index/src/index_generator.cpp (original)
+++ sandbox/tools/auto_index/src/index_generator.cpp 2011-06-27 13:19:21 EDT (Mon, 27 Jun 2011)
@@ -149,9 +149,9 @@
 
 boost::regex make_primary_key_matcher(const std::string& s)
 {
- static const boost::regex e("[-_[:space:]]+");
- static const char* format = "[-_[:space:]]+";
- return boost::regex(regex_replace(s, e, format), boost::regex::icase|boost::regex::perl);
+ static const boost::regex e("[-_[:space:]]+|([.\\[{}()\\*+?|^$])");
+ static const char* format = "(1?\\\\$1:[-_[:space:]]+)";
+ return boost::regex(regex_replace(s, e, format, boost::regex_constants::format_all), boost::regex::icase|boost::regex::perl);
 }
 
 //


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk