aureliojargas / txt2regex

Regex wizard for the terminal, written in Bash
https://aurelio.net/projects/txt2regex/
GNU General Public License v2.0
183 stars 26 forks source link

either not seen, or feature suggest #8

Closed robertwerner67 closed 1 year ago

robertwerner67 commented 3 years ago

For a few days, I use txt2regex (version 0.9) successfully to write regular expressions from the left to the right. As noticed in expressions written by a colleague, these assertions equally may check of what is written prior to the position initially checked, e.g., the negative look-behind (?<!e)s which would identify instances of s trailing i (like in fish), and skip s trailing e like in test.

My question: are these look-behinds already implemented txt2regex, or maybe foreseen to be implemented in a later version of this very useful program?

aureliojargas commented 1 year ago

Hi @robertwerner67,

First of all, I'm sorry for the long time it took me to answer your question.

Look-behind, look-ahead, named groups, non-greedy quantifiers and other modern regex metacharacters are not supported by txt2regex.

Being a "wizard", that tries to be simple and friendly to regex newcomers, it supports only a subset of all the regex power available in the engines.

Those are the supported metacharacters:

. [] [^] * + ? {} | ()

I'm not opposed to growing that list, but currently there are no plans on doing it.