Home Download Buy Blog Forum Support

regexes confused by multiple key bindings?

regexes confused by multiple key bindings?

Postby pierre on Thu Mar 24, 2011 9:04 am

This is a sequel of a previous post which was a bit
confused, now I think I can ask a precise question:

The following keybinding works fine:
[
{
"keys": ["a"], "command": "insert_snippet", "args": {"contents": "\\alpha"},
"context":
[
{ "key": "preceding_text", "operator": "regex_match", "operand": "^$" }
]
}
]

When you press 'a' at the start of a line (empty or not) it inserts
\alpha, otherwise it inserts 'a'. I can see no difference if I use
"regex_contains" instead of "regex_match"

But the following binding does not work:
[
{
"keys": ["a","b"], "command": "insert_snippet", "args": {"contents": "\\alpha"},
"context":
[
{ "key": "preceding_text", "operator": "regex_match", "operand": "^$" }
]
}
]

Here when I press "a" "b" in sequence, nothing happens ever, beginning
of line or not. Same thing with "regex_contains". If I replace the regex
with "^" , still nothing, and finally the combination regex "^" and
"regex_contains" always matches, anywhere in the line.
I can't understand what is going on

Piero
pierre
 
Posts: 28
Joined: Sat Mar 19, 2011 8:47 pm

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 11 guests