Euphoria Regex suggestions

new topic     » topic index » view thread      » older message » newer message

I was getting ready to port my personal wrapper for pcre that I've been using for years to use the internal pcre, but I see that some critical functions have been left out of the Eu version that seriously limit the potential of using the built-in regex in Euphoria. The big one is the lack of support for named subpatterns. Without the ability to access a pattern by name, it pretty much means any complex regex patterns cannot be used, sanely anyways. Because with many and nested patterns, and the fact that every time you add a pattern or take one away they are all renumbered, working with matched patterns by number is a serious handicap and highly bug-prone. (Basically not worth it except for small and simple patterns, but a complex regex pattern can be quite huge with conditional branches, etc. Names are absolutely essential for these.) To gain all this power only one other function needs to be included from pcre: pcre_get_stringnumber (converts pattern name to pattern number) And there are some other tricks/more power that can be achieved with access to the information pcre provides with its internal function pcre_fullinfo. By adding those two functions to the eu wrapper the usefulness of the regex library could be increased tenfold. Also helpful would be some other minor tinkering to go along with it to allow more flexible extractions of matches instead of always returning all of them, but that could be done in the eu API as long as you could match names to numbers and have access to the full map that pcre_fullinfo provides (in the case of using duplicate pattern names, you need this to find them all).

The API would need some beefing-up as well, something I could do, at least on the Euphoria side. But I see some API functions are internal (find_replace) which would be beyond my capability. Anyway, I'd like to make a STRONG suggestion that this expanded support be included in a future version as the power of the underlying library is being wasted...

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu