I’m currently trying to write a small syntax highlighting script where I have the following regex:
[^\w](int|for)[^\w]|^(int|for)[^\w]|(int|for)$
Now when I type
for int
With a space after the last int, the for gets highlighted but the int doesn’t and I don’t understand why. I was thinking that ” int ” is matching the regex.
When I try to type
bla bla for bla bla
The for gets highlighted. Could anyone explain me why ” int ” is not matching with the above regex?
Thanks in advance!
It’s to do with your
$(assert position at end of line) – try and remove it and it should work fine.