How can I fix my RegEX expression so it doesn't match the whole line after?

125 Views Asked by At

I'm working on an VS Code extension for LOLCode. I've gotten most of my RegEx expressions to do what I want but when I tried to work with isolating variables in some instances it includes almost everything in the line. I'm really not sure how to fix my RegEx to get the right results. enter image description here

My RegEx expressions

"variables": {
            "patterns": [
                {
                    "begin": "\\b(?<=I HAS A)\\b",
                    "end": "\\b(?=ITZ)\\b",
                    "contentName": "variable.color.lolcode"
                },
                {
                    "name": "variable.color.lolcode",
                    "match": "^.*(?= R |I HAS| CAN HAS |HAS)"
                },
                {
                    "name": "variable.color.lolcode",
                    "match": "\\b(?<=YR|OF|SRS|SMOOSH|AN|SAEM|VISIBLE|INVISIBLE)((?!.*(LOOP|UPPIN)).*)(?=AN|TIL|ITZ|MKAY|'Z)\\b"
                },
                {
                    "name": "variable.color.lolcode",
                    "match": "\\b(?<=YR|SAEM|AN|SRS|ITZ|VISIBLE|INVISIBLE)((?!.*(LOOP|MKAY)).*)(?=\\n+?)\\b"
                }
            ]
        },
0

There are 0 best solutions below