How to regex a multi line comment for a language package?


I am completely new to grammar in Atom and have no clue on what the regex would be to create a multi line comment in atom. I managed to create a part of it, the problem is it doesn’t do multi line.


By that I am able to do

<! This is a comment !> This is not a comment

however I am not able to do

 <! This is a comment         This is still a comment
    This is also a comment !> Now this is not a comment

The code I use in the language package is:

'scopeName': 'source.s-e-t'
  'name': 'PackageName'
  'fileTypes': [
  'patterns': [
    'match': '\<\!(.*)\!\>',
    'name': 'comment'

So how would I make a regex support multiple lines containing text that will be commented between <! & !>

Thanks in advance!


You want to use begin and end to match for the tags. You can see an example of this in most major language packages, like here.


Thanks a lot! It worked great!


Just an FYI: the grammar package is largely based on the Textmate editor’s implementation, to the point that I found this very helpful: Textmate Manual: Grammars