2

Please could you explain why given the following boost::regex pattern:

boost::regex re("/\\S+\\w");

/index.html is a match and /~index.html is not? RegexBuddy in Perl mode finds a match in both cases.

Could you suggest a pattern that would work? Thanks!!

P.S. The \\w at the end is needed in order to ignore the punctuation on the end of an URL like /index.html..

UPD: Sorry just tried to make a simple test program and it works there. I guess the problem might be in the code that calls regex_search. I need a bit more time to find this out.

UPD2: Indeed the problem was in my code. Please vote to close the question. Sorry for not researching enough before posting.

Harry Johnston
  • 35,639
  • 6
  • 68
  • 158
Alex Jenter
  • 4,324
  • 4
  • 36
  • 61
  • 1
    I have not worked on boost!!!!. Is escaping character is really required for \S and \W ?..?. "\/\S+\w" This works for me in Perl – vrbilgi Oct 25 '10 at 08:33
  • 1
    Boost is a c++ library and c++ string escaping is not as weak as the perl. the \\S and \\w are correct. – VGE Dec 22 '10 at 18:13
  • I think as question asker you can close or delete the question yourself. – Nick Knowlson Aug 25 '11 at 21:54

0 Answers0