-
I'm sure this is quite simple, but I have a mode that should start with const EnterGate = createToken({
name: "EnterGate",
pattern: /@{/
push_mode: "gate_mode"
});
const ExitGate = createToken({
name: "ExitGate",
pattern: /}@/
pop_mode: true
});
const Gate = createToken({
name: "Gate",
pattern: ??
}); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can probably use something like |
Beta Was this translation helpful? Give feedback.
-
Thanks, though actually I'm thinking a better option might be to start with Perhaps I should open a separate discussion ticket for this? |
Beta Was this translation helpful? Give feedback.
You can probably use something like
(?:(?!}@).)*
. It uses a negative lookahead group (?!
) to prevent matching}@
and then attempts to match any character.
. This is repeating until it arrives at the end of the input or the}@
sequence.