Regex not working as it should

Hi i tried to create a new mode:

CodeMirror.defineMode("mustache", function(config, parserConfig) {

    return {
    token: function(stream, state) {


        //  if (stream.match(/\t[\s\S]*(?=\|)/g) ) {

        //https://regex101.com/r/rB7pO8/2
        //marking all sentences, only the last stays unmarked
        if (stream.match(/\t([\S \n\r]*)\|/g) ) {
            return "blue";
        }
    }
   };

});

Works fine so far but the regex is just not used correctly. Here is my test online: https://regex101.com/r/rB7pO8/3
The codemirror stream.match will not match the string where ist has \n\r

Any ideas, i mean the regex works outside of codemirror.

Tokens can’t span lines, so your regexp will only ever be applied to a single line at a time.

so how can one mark multiple lines? Or is this even possible? Maybe i try the impossible?

Keep state. Set something in your state object that will make the next call to token aware of the context you are in. But recognizing the last sentence in a paragraph is probably impossible – that would require arbitrary lookahead, which CodeMirror modes do not support.

ok thx. if its not possible i can stop my idea.