tags:

views:

752

answers:

6

Is there a library in the VCL for regular expressions?

If not can you recommend a good third party library.

I am using Delphi 2009

+3  A: 

Delphi does not provide a regular expression library in the VCL.

There are some third party regular expression units.

DIRegExp

TRegExpr[2] (site is down 22.9.2009)

sdu
+1  A: 

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...

The Chairman
+3  A: 

See TPerlRegEx (download) even though it's only a wrapper around PCRE.

François
-1 This doesn't answer this question at all
Willbill
@Willbill. ... and you know better than the OP who accepted the answer?
François
@François - I sure do. The answer to the actual question i.e. "no the vcl does not prvide a regular expressions library" is not there. The library that is mentioned in this answer is not part of the Delphi VCL (a fact that is not mentioned anywhere in the answer). This is a great answer to question http://stackoverflow.com/questions/1282749/
Willbill
+3  A: 

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.

Deltics
+1  A: 

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

delphigeist
A: 

If you are going to use Jedi Code Library(JCL), you will still need to to install a PCRE library.

David Gray