Boost regex asterisk issue

Nov 19, 2012 at 1:29pm
Hey all,

I've been playing around with the boost filesystem and regex libraries. I'm coming across a really annoying bug.

This page:

http://rosettacode.org/wiki/Walk_a_directory/Recursively

Has how to walk through directories in a recursive fashion. You search down to boost and it implements a regex variable:

boost::regex pattern("a.*");

I can add this code to my project fine and it compiles.

If, however. I declare this:

boost::regex pattern("*.mpeg");

the program will build but not run.

This is the error message:

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

I may be messing up the way regular expressions are used but I just want to
search for filename extensions in a program. I thought regular expressions would be great for this purpose.

Anyway, any help would be appreciated.
Nov 19, 2012 at 3:49pm
catch that exception and print its .what() string so that you know what's going on.

And yes, that is not a valid regular expression. Asterisk doesn't mean "any number of any characters", it means "match the previous atom zero or more times"
Topic archived. No new replies allowed.