Hello,
i am trying to parse the HEADERS and SOURCES section of a Qt project file.
Given the following content:
SOURCES += \
../Source/Test1.cpp \
../Source/Test2.cpp \
win32 {
SOURCES += \
../Source/Test.cpp
}
SOURCES += \
../Source/Test1.cpp \
../Source/Test2.cpp \
win32 {
SOURCES += \
../Source/Test.cpp
}
To copy to clipboard, switch view to plain text mode
When searching with a regular expression, the matched result should be this:
SOURCES += \
../Source/Test1.cpp \
../Source/Test2.cpp \
The other SOURCES block should not be part of the result, cause it is wrapped in a {} block.
My base expression, which will match both is this, it works fine for the tests i have done.
SOURCES\s+(\+=|=)(\s+(.+\.cpp)?\s*\\?){0,}
SOURCES\s+(\+=|=)(\s+(.+\.cpp)?\s*\\?){0,}
To copy to clipboard, switch view to plain text mode
Then i tried to exclude the second block by appending
\s*(?!\})
\s*(?!\})
To copy to clipboard, switch view to plain text mode
but this did not work as expected (changed nothing).
I am testing the expression using this side http://gskinner.com/RegExr/
Does anyone have an idea why this does not work?
Bookmarks