1

I need to build an expression which matches generic #include "file.h" code line.

Is the following correct for that purpose?

([[:blank:]]*#include[[:blank:]]*")([[:print:]]*\.h)([[:print:]]*)

The expression should match for the followings:

#include     "header.h" //first include

     #include "header2.h"      //second include

#include "header3.h"

I use boost regex library.

2
  • 1
    regextester.com try it out... Commented Jan 23, 2013 at 12:27
  • Could you explain what dialect I need? Commented Jan 23, 2013 at 12:53

1 Answer 1

2

Boost Regex can use Perl, Or POSIX regular expression syntax : http://www.boost.org/doc/libs/1_52_0/libs/regex/doc/html/boost_regex/syntax.html

So you can check and test your regex here: http://www.regextester.com/

Just set to preg (perl) if you are using the default behaviour of boost (See above).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.