1. Technology

RegEx / Regular Expression Components for Delphi

A collection of hand picked Regular Expression Libraries for Delphi

By

A regular expression (regex, regexp) is a string that describes or matches a set of strings, according to certain syntax rules. Regular expressions are used as a powerful and convenient way to recognise patterns in text.

Using regular expressions you can validate e-mail adresses, extract ZIP-codes from documents, search for complex patterns in files and much more.

RegEx for a valid file name: (?i)^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\\\./:\*\?\"<>\|][^\\/:\*\?\"<>\|]{0,254}$

Delphi does not provide a regular expression library in the VCL, so you will need to use a third party VCL component.

1. TPerRegEx

TPerlRegEx Delphi source, PCRE C sources, PCRE OBJ files and DLL are included. You can choose to link the OBJ files directly into your application, or to use the DLL. TPerlRegEx has full support for regex search-and-replace and regex splitting, which PCRE does not. Full documentation is included with the download as a help file.

2. TRegExpr

Full source code included, pure Delphi code.

3. DIRegEx

DIRegEx is a library of Delphi components and procedures that implement regular expression pattern matching using the same syntax and semantics as Perl 5.10, with just a few differences. This includes support for UTF-8 encoded strings and Unicode general category properties.

©2014 About.com. All rights reserved.