randy3k / AlignTab

An alignment plugin for Sublime Text using regular expression
MIT License
631 stars 25 forks source link

regex patterns not found #89

Closed YideTian closed 2 years ago

YideTian commented 2 years ago

I'm trying to use regular expressions to find the left bracket. following 2nd and 3rd lines are my target. So i need to find dot mark first,and then the left bracket.

    inst u_inst (
    .clk    (clk),
    .rst (rst)
    );

and my regular expression is below:

    {
      "keys": ["f2"], "command": "align_tab",
      "args" : {"user_input" : "=(?<=(\\.{1})(\\s*)([0-9a-zA-Z]+)(\\s*))\\(/f"}
    },

The debug tool proved that it works. image but in sublime, it seems that the pattern is not working. image

randy3k commented 2 years ago

There are different variations of regex. The variation used by AlignTab follows from the re module of python, which has only limited support of look behind (i.e., it doesn't support look behind patterns with unknown lengths). I beleive that the version used by the website that you used is for javascript and it has better support in this aspect.

YideTian commented 2 years ago

ok, thank you for your response.