Suggestion: Regular expressions

Recently, I’ve asked Julian to implement regular expressions using the TRE library (it’s small and portable). But I’ve changed my mined when I’ve tested a more powerful regular expressions library. It’s as powerful as the Microsoft regular expressions in .NET. So, Julian, if you plan to introduce regular expressions in JUCE in the nearest future, please, consider the PCRE library that can be obtained here

ok, thanks for the heads-up on that one!

if you are interested, i’ve coded a wrapper around pcre in juce which uses juce String and let you get the matched string and indexes in the original one (so you can split it up as you like):


the only pity is that C++ doesn’t treat regex by default, and so you have to double escape control characters (\d should become \d in a string)… but that’s another matter !

feel free to use and abuse !

Thank you, kraken :slight_smile:

Honestly, currently I use one of the contributed C++ wrapper classes from the PCRE web-site. But, I’ll definitely give a try to your class.

Thank you once again.

If you want a very small but almost fully functionnal regex engine, please search for libbitap in google.

Libbitap is being used in “grep” tool under linux, and it is probably the fastest regex engine outthere at the cost of no backtrack search.

Libbitap is very very small (like 100 lines), while PCRE is a beast.

I’ve used a lot of regex lib (from PCRE, basic glibc regex, bitap algorithm, regex++ and boost), and from my POV, most features of PCRE are overkill (and consume space => higher app launch time), glibc regex is good, but limited to linux, and boost is a magnific card castle.
I never used TRE before, so I can’t comment on it.

Anyway, good luck

yeah X-Ryl669, i’m looking for a clean and simple regex implementation that require no dependancies, so i can package it in a single class for juce use without need to copy here and there those big bloated libraries you mention :slight_smile:

thanx for let me know !