I'm having an issue when using re.search() or re.findall(). But let me explain first. I'm searching through C-Code, which contains definitions like this:
#define SOME_FUNCTION( someArgument, someMoreArgument)
Sometimes, when they have a lots of arguments, they are wrapped, so they look like this:
#define ANOTHER_FUNCTION( moreArgument, evenMoreArguments,
anAwfulLotOfArguments, youGetIt)
Now I'm using python to scan through these files to find every single one of these definitions. My regex looks like follows:
#define [A-Z,_]*\((?:.|\s)+?\"
When testing this with single- and multiline definitions in testing engines like regex101.com it works flawlessly.
However, when I use this with python (3.4.1), it only works for single-lined definitions. When it tries to scan multiline definitions, it just stops executing (although I can interrupt it with Ctrl + C). I tried using :
regexFullMacro = re.compile("#define [A-Z,_]*\((?:.|\s)+?\)")
match = regexFullMacro.search(searchString)
as well as
regexFullMacro = re.compile("#define [A-Z,_]*\((?:.|\s)+?\)")
match = regexFullMacro.findall(searchString)
where both tries just stop responding when it comes to multiple lines.
Has anyone had this issue before or am I just utterly stupid and missing something obvious?