Regex Guru

Thursday, 8 October 2009

TPerlRegEx for Delphi 2010

Filed under: Regex Libraries — Jan Goyvaerts @ 15:20

Ever since I updated TPerlRegEx to support Unicode on Delphi 2009, it’s been plagued by a bug in Delphi that triggers an internal error when linking the PCRE OBJ files into your application, if you had TPerlRegEx installed into a design time package. So I changed TPerlRegEx to link in the PCRE code from a DLL instead of the OBJ codes, at least by default.

This bug has been fixed in Delphi 2010. I have updated TPerlRegEx to use the OBJ files by default for Delphi 2010, and the DLL for earlier versions of Delphi. This is the only change. The DLL and OBJ files themselves haven’t changed since August’s release. You can still make Delphi 2010 use the DLL or make older versions use the OBJ files (as long as you don’t use design time packages) by editing the compiler directives at the top of pcre.pas.

Download TPerlRegEx. Source is included under the MPL 1.1 license.


  1. I have a suggestion regarding TPRex that you may please upload TPerlRegEx code base to an SVN server(sourceforge or google code), so that any change to the original code can be easily syncronized with user’s code.

    It is just a suggestion! 😉

    Comment by Yona — Wednesday, 14 October 2009 @ 17:08

  2. So is there possibility to use TPerlRegEx with unicode on Delphi 2006?

    Comment by Alek — Thursday, 1 April 2010 @ 18:31

  3. TPerlRegEx uses Unicode on Delphi 2009 and later only. If you want it to use Unicode on earlier versions of Delphi you’ll need to modify PerlRegEx.pas to pass the PCRE_UTF8 flag to the pcre function calls and you’ll need to make sure that your code passes all strings as UTF-8.

    In Delphi 2009 and later the compiler knows that the UTF8String type uses the UTF-8 encoding and automatically converts strings if you assign UTF8String to/from a different string type. In earlier versions of Delphi there is no difference between UTF8String and AnsiString.

    If you want to use Unicode, I strongly recommend you upgrade to Delphi 2010 if you’re using Delphi 2007 or earlier.

    Comment by Jan Goyvaerts — Friday, 2 April 2010 @ 10:02

Sorry, the comment form is closed at this time.