Regex: find words following on "^\w+\s+" – New Syntax Definition (MMIX) – Sublime Text 3


I am trying to create a syntax definition file for the MMIX assembler language. These files are used by Sublime Text 3 to highlight the syntax of a text/source file and as of late are written in YAML.

Instructions that follow on ^\s+ are highlighted correct, ^\s+ADD\s+ for example.
Instruction following on white space
(f.l.t.r: Syntax definition file, MMIX source)

However, instructions following a label and white space get not highlighted alone, but rather everything from the beginning of the line to end end of the regexp gets highlighted.

^\w+\s+IS\s+ does not work right.
Instructions following a label and white space

I recently learned some theory about regular expressions, but never have used them on a computer.

How can I achieve, that only the token IS gets highlighted?


You can use a Positive Lookahead, try the following.


Answered By – hwnd

Answer Checked By – Mary Flores (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.