Fix regular expression when replacing headers
authorHarald Fernengel <harald.fernengel@nokia.com>
Wed, 2 Nov 2011 23:42:32 +0000 (00:42 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 3 Nov 2011 09:04:56 +0000 (10:04 +0100)
Use non-greedy capturing where it makes sense, also
keep the user's whitespace indentation in his include statements

Change-Id: Iff2b5dabf443529292e943ae69427bd15e702bf9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bin/fixqt4headers

index 58b0fdf..0679341 100755 (executable)
@@ -13,7 +13,7 @@ for module in $modules; do
         includes=`ls $QTDIR/include/$module`
         for i in $includes; do
 #            echo "    fixing " $i
-            perl -pi -e "s,^#include +<.+/$i>,#include <$module/$i>," $files;
+            perl -pi -e "s,^#(\\s*)include(\\s+)<.+?/$i>,#\\1include\\2<$module/$i>," $files;
 #            perl -pi -e 's,^#include +".+/$i",#include "$module/$i",' $files;
         done;
     fi;