views:

28

answers:

1

I am trying to replace all the #include "whatever.h" with #include <whatever.h> using find and replace functionality in Visual Studio 2005. I used the regex \#include \"[a-z\.h]+\" to find the include statement. But I am wondering how frame the replace regex.

\#include \<[a-z\.h]+\> did not work and won't; it replaces the statement #include "whatever.h" with #include <[a-z.h]+>. How shall I frame the replace regex to retain whatever.h as it is?

+3  A: 

It works when I do this: find include "{[a-zA-Z]+\.h}", replace with include <\1>. The most relevant parts for your question are the curly braces {} and the back reference \1: \n references to the n'th group indicated by curly braces in the search expression.

Miel