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.
(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.
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.
IS(?=\s)