RamonUnch / GreenPad

Fork from roytam1 fork from original GreenPad
21 stars 0 forks source link

Non-greedy operator support in regular expression in search/replace #185

Open roytam1 opened 4 months ago

roytam1 commented 4 months ago

One of missing function of our current regular expression in search/replace is non-greedy operator(i.e., ?) to search shortest possible match of pattern.

But unfortunately I'm not familiar with our current regular expression engine used in GreenPad and I wonder if it is feasible to be done without replacing it with something else.

BTW a small regex library for reference: https://github.com/gyrovorbis/tiny-regex-c

RamonUnch commented 4 months ago

Indeed regexp are quite limited, also there are no capture groups for replace. And it does not handle multi-lines matches. I thought about improving all of this but this part of the code code is quite tricky to navigate for me.