Highlighting spaces Textmate

I want to modify the solution for highlighting hidden white space as described here , WITHOUT highlighting spaces for otherwise blank lines.

I changed this in my Python language file:

        {   match = '(\s+)$';
        captures = { 1 = { name = 'invalid.whitespace'; }; };
    },

      

For this:

        {   match = '\S(\s+)$';
        captures = { 1 = { name = 'invalid.whitespace'; }; };
    },

      

This new expression no longer looks like anything. What am I doing wrong?

0


a source to share


2 answers


Try statements:

(?<=\S)\s+$

      



They are well documented in the PHP manual (they are of course not PHP specific, just php.net seems to have a fairly readable version of the document).

+1


a source


The problem with your pattern is that the previous nonspatial character is presumably already matched by another rule, and therefore not available for your rule. Using an assertion, as porneL suggests, is the correct way to do this.



+1


a source







All Articles