I wrote my own small syntax for tables.
_My syntax_: https://gist.github.com/Kristinita/4105b1b48fb3dfc7ba13a0c09f9fb216
_My color scheme for syntax_: https://github.com/Kristinita/SashaSublime/blob/master/SashaSublime.tmTheme
_Example file, when use this syntax_: https://gist.github.com/Kristinita/39286e4165fa74ea54b52aa41b14ef81
In syntax not works pattern, that work correctly on regex.101.com site:
_Pattern_: (?<=^\| )[0-9]{1,2}(?= )
_regex101_: https://regex101.com/r/gR8lV6/1

I want consume digits between | and space only when | is in the beginning of a line. If I don't write a symbol ^, figures will be consume in other places, see https://regex101.com/r/gR8lV6/2:

I do not want to consume digits in other places as in the screen 2. But in Sublime Text pattern
- match: (?<=^\| )[0-9]{1,2}(?= )
scope: kira.numbers
all digits don't highlighted. Pattern (?<=\| )[0-9]{1,2}(?= ) is work for me in Sublime Text.
Thanks.
iirc, ^ means the position of current seek rather than line beginning in ST syntax parser.
If it's true, in that case, maybe maintain an extra context called first-column to tackle with it.
BTW, this post is not official-package-related, isn't it? More appropriate to post this in ST forum?
Just read your syntax def. ST matches a rule as early as possible (better performance) rather than try to match all rules and select the longest match.
So, move
- match: (?<=^\| )[0-9]{1,2}(?= )
scope: kira.numbers
to the first rule would work in this case.


And your color scheme looks really nice :+1:
@jfcherng , thanks, it works! But this is probably a bug, I think, it should not be that in what place there is a rule.
Where should I write, if you have any problems with my syntax?
(I'm sorry, what program you have made your screenshots? What is the effect that you have used?)
Thanks.
The oniguruma regex engine used when lookbehinds are present does not seem to support anchors in lookbehinds: http://stackoverflow.com/questions/3391450/ruby-1-9-regex-lookbehind-assertion-anchors.
Generally you can replace all look-behinds with a context that is entered when you find the pattern you were looking behind for.
For example, create a rule that matches ^\| and enter a new context. In that context, if you match \s+(\d+), highlight is specially. If not (via a blank match or a lookahead that matches a non-space char), pop out of the special context.
You can see this pattern in action at: https://github.com/sublimehq/Packages/blob/master/Ruby/Ruby.sublime-syntax#L267-L281.
@wbond , is not Oniguruma problem: see comments of Vince Fitz and K.Kosako — developers of Oniguruma.
Thanks.
Most helpful comment
Just read your syntax def. ST matches a rule as early as possible (better performance) rather than try to match all rules and select the longest match.
So, move
to the first rule would work in this case.
And your color scheme looks really nice :+1: