I have this piece of language grammar to match a struct in D :
begin = '(?x)^\s* ((?:\b(public|private|protected|static|final|synchronized|abstract|export|shared)\b\s*)*) # modifier (struct)\s+ (\w+)\s* # identifier (?:(\s*([^)]+)\s*)|)\s* # Template type (if\s*(\s*([^)]+)\s*)|)?\s* # Template constraint '; end = '(?={|;)';
It will match this code, as an example:
struct Foo(A) if (true) { }
The problem is if I put the "if" on a new line it won't match. How can I make the rule match across several lines?