Table of Contents

DIRegEx

DIRegEx is a library of components and procedures that implement regular expression pattern matching using the same syntax and semantics as Perl for Delphi (Embarcadero / CodeGear / Borland).

YuPcre2 supersedes DIRegEx

Mid 2015 saw the first release of the new YuPcre2 Delphi regular expression library as the successor of DIRegEx. YuPcre2 has an improved interface, optimized performance, and lots of new features.

Since then, both DIRegEx and YuPcre2 have been developed in parallel. DIRegEx continued to receive security fixes, optimizations, and even improvements. Development of new features, however, took place in YuPcre2. As of 2020, development will focus entirely on YuPcre2. DIRegEx will see considerably less updates – maybe even none at all.

Users of DIRegEx are encouraged to deploy YuPcre2 for the newest Delphi regular expression technology. To ease migration, the YuPcre2 units and components are named as closely as possible to those of DIRegEx. Changes compared to DIRegEx are described here. A demo is available to start the conversion of existing projects, including testing.

Overview

DIRegEx offers two regular expression algorithms with their corresponding wrapper classes for easy usage:

The DIRegEx Search Stream Demo ApplicationBoth classes descend from a common ancestor TDIRegEx which implements the complete functionality for working with regular expressions, regardless of which algorithm is currently in effect:

Syntax Implemented

The DIRegEx Workbench ApplicationThe implemented regular expression syntax is Perl 5.10 compatible and covers the following:

Additional Features

DIRegEx can do a Format and Replace based on regular expressions, a feature often required for advanced text editors and word processors. It is possible to include parts of the originally matched text into the replacement.

The List function concatenates all reg-ex matches to a single string. It allows to build lists of phone numbers, e-mail addresses, etc. with a single function call only.

RegEx Mask Controls

The DIRegEx Mask Controls Demo ApplicationDIRegEx also includes two regular expression edits: TDIRegExMaskEdit and TDIRegExComboBox. Both controls validate all keyboard input against a regular expression pattern. They work similar to Delphi's TMaskEdit, but are much more flexible and powerful.

The regular expression mask controls allow to:

DIRegExMaskEdit

TDIRegExMaskEdit is an edit control that validates all keyboard input on a keystroke by keystroke basis. It accepts characters entered only if the new text matches the regular expression mask pattern. If the new text does not match, the character is silently rejected.

DIRegExMaskComboBox

TDIRegExMaskComboBox is a combo box control with essentially the same regular expression validation as TDIRegExMaskEdit.

Workbench Application

The DIRegEx Workbench helps you to design and test your regular expressions. It allows to set all available options, measure execution times, and to save and load all settings for later use.

The DIRegEx Workbench is available as a