I can't make syntax highlighting make it work with RegEx


I’m creating a package to find and rightlight certain words in a file.

I can get numbers and name, but I can not get it \xfff to work.

I can make Regex work as you can see in the follow link https://regex101.com/r/UNiOYw/1
But the text is not highlighted in the package.


This is my patterns:
‘patterns’: [
‘match’: ‘\b[0-9]+\b’
‘name’: ‘constant.numeric.pkmtrd’
‘match’: ‘\b\[x][f]+e\b’
‘name’: ‘support.other.pkmtrd’


my patterns code in pastebin


You are using a string, so all backslashes must be escaped. For example, a literal backslash would be \\\\

Edit: It seems you have in the regex example, you just didn’t mark it as code properly in this forum.

Check the scope with Editor: Log cursor scope in the command palette. It most likely is working, but you haven’t assigned a colour to that scope.


Hello, I solved the problem. As the text I would like to add a highlightning syntax was along with other characters then it was necessary to remove the “\b” from the begin and end of the regex.

  match: "\\[x][f]+e?"
  name: "constant.character.escape"


Thanx for the help!