Reputation: 11753
Is there a library in the VCL for regular expressions?
If not can you recommend a good third party library.
Upvotes: 9
Views: 6848
Reputation: 36634
Starting with Delphi XE, the RTL contains support for regular expressions:
http://docwiki.embarcadero.com/RADStudio/en/VCL_and_RTL_Changes_for_XE
RegularExpressions.TRegEx is the main record for the user to match and replace with regular expressions. The members of the RegularExpressions unit make up an interface very close to the MSDN interface, ...
and
RegularExpressionsCore.TPerlRegEx implements Perl-compatible regular expressions (http://www.regular-expressions.info/pcre.html).
Upvotes: 9
Reputation: 21640
See TPerlRegEx (download) even though it's only a wrapper around PCRE.
Upvotes: 4
Reputation: 2838
Delphi does not provide a regular expression library in the VCL.
There are some third party regular expression units.
TRegExpr2 (site is down 22.9.2009)
Upvotes: 5
Reputation:
If you are going to use Jedi Code Library(JCL), you will still need to to install a PCRE library.
Upvotes: 0
Reputation:
Jedi Code Library(JCL) provides a perl based regular expression. Download JCL from this link.
After install go to installation folder/source/common and you have JclPCRE.pas and pcre.pas
Upvotes: 5
Reputation: 23036
There is not one "in the box", as mentioned by others. However, we need to be careful when we say "can we have regexp in the IDE/VCL", because two different people asking for this may have two very different ideas as to which regexp they want to see supported.
So whilst it might nice to have a form of regexp support "built-in" you have to be aware that this will lead to problems when people start exchanging regexp recipes (with other people not using Delphi) and can't figure out why one person's valid regexp is not a valid regexp in Delphi.
So then it will be "regexp is broken in Delphi" or "why can't we have XYZ regexp support as well as the ABC flavour support?"
So at the moment I'd say having the choice as to which regexp is right for you is in some ways an advantage, assuming you can find a component/library for Delphi which supports that flavour. :)
The regular-expressions.info site also has a page specifically about Delphi support for regexp.
Upvotes: 3
Reputation: 7187
RegEx is another thing you don't have in Delphi. Perhaps you try the PCRE-based Components for Delphi (didn't test it myself).
I used TRegExp (mentioned by sdu) a few years ago but now the link seems to be dead. Curious...
Upvotes: 1