SpartanJ / ecode

Lightweight multi-platform code editor designed for modern hardware with a focus on responsiveness and performance.
MIT License
884 stars 13 forks source link

Feature request: support Regular Expressions in search #147

Open iahung3 opened 3 months ago

iahung3 commented 3 months ago

I'm pretty sure that the editor currently doesn't support Regular Expressions in Find/Replace. Only Lua Pattern is available.

SpartanJ commented 2 months ago

This is correct. I tried to avoid to add more complexity given that a fast PCRE implementation would require to add an extra dependency and a big one, which I'm not a fan of it. Using the std regex would be too slow for my taste, so I never decided what to do about it. Lua Patterns are awesome an very powerful, I encourage all users to learn and try them. Here's a good reference. Regex's will be added, but I'm still undecided on the "how".

iahung3 commented 2 months ago

What is so wrong with pcre2? I found both Lite XL and Pragtical make use of it to support Regular Expressions.

SpartanJ commented 2 months ago

There's nothing wrong, it's just not as fast as I would like, but ecode will use PCRE2 given that it's the only library available with no dependencies. But the ideal library available is hyperscan. Here you can see a good benchmark.

iahung3 commented 2 months ago

There's nothing wrong, it's just not as fast as I would like, but ecode will use PCRE2 given that it's the only library available with no dependencies. But the ideal library available is hyperscan. Here you can see a good benchmark.

This benchmark result is not updated for 2 year. hyperscan itself is not updated for 1 year, too. Looking at the issues page of hyperscan, I have the impression that they abandoned it. PCRE2 is still the industry standard. Even if hyperscan is still being developed and has better performance, I still suggest you to just use PCRE2. It will always be the most full featured solution.

SpartanJ commented 2 months ago

Don't worry, PCRE2 will be used, it's already decided.