Matching multiline string for syntax highlighting


I’m creating a custom language grammar and I want to match this:

TESTCASE lorem ipsum…

My regexp for matching “@ignore”, ignore whitespaces/newlines, “testcase” is:

According to an online oniguruma engine this regexp correctly matches e.g. @Ignore \n TESTcase, but however in my language.cson this does not work:
“begin”: “(@\b(?i:ignore)(\W*)(?im:(.*)testcase))”,
“end”: “(?=(?i:end-testcase))”,
“name”: “comment.test”

So I am wondering if the string to be matched with the begin regexp is always only one line?
If so, how could I solve my problem?

Until now, everything works fine if the user writes

@Ignore Testcase lorem ipsum…

but adding a newline after @Ignore breaks the highlighting…and that is bad.

Any ideas?


Yes, matches are single line only. There’s no way around that in a pure language grammar.