Table of Contents

YuPcre2

YuPcre2 is an up to date regular expression library for Delphi with Perl syntax. Directly supports UnicodeString, AnsiString, or UCS4String, as well as UTF-8, and UTF-16.

Overview

YuPcre2 provides two matching algorithms, the standard Perl and alternative DFA algorithm:

YuPcre2 has native interfaces for 8-bit, 16-bit, and 32-bit strings. Component wrappers are available for UnicodeString / WideString and AnsiString / Utf8String / RawBytestring:

Component String Types Comment
TDIPerlRegEx2_16.png TDIPerlRegEx2_16 16-bit strings:
UnicodeString, WideString
Full UTF-16 Unicode processing if coUtf CompileOption set.
TDIDfaRegEx2_16.png TDIDfaRegEx2_16
TDIPerlRegEx2_8.png TDIPerlRegEx2_8 8-bit strings:
AnsiString, RawByteString, Utf8String
Full UTF-8 Unicode processing if coUtf CompileOption set.
TDIDfaRegEx2_8.png TDIDfaRegEx2_8

Search Stream Demo ApplicationThe YuPcre2 RegEx2 classes descend from common ancestors which implement the core functionalities:

Users familiar with the DIRegEx might be interessted in the differences between YuPcre2 and DIRegEx.

Pattern Syntax

YuPcre2 RegEx2 Workbench Application The YuPcre2 regular expression pattern syntax is mostly compatible with Perl. It includes the following:

YuPcre2 RegEx2 String Processing

YuPcre2 can Replace, List, or Format regular expressions matches or any of its substrings, useful for text editors and word processors. Variable portions of the match can be included into the result text. The full match can be referenced by number, substrings also by name. The character to introduce these reference is freely configurable. FormatOptions allow to turn features on or off as required.

YuPcre2 RegEx2 MaskControls

The YuPcre2 RegEx2 MaskControls Demo ApplicationYuPcre2 includes two regular expression mask edits: TDIRegEx2MaskEdit and TDIRegEx2ComboBox. Both controls validate keyboard input against a regular expression. They work similar to Delphi's TMaskEdit, but more flexible and powerful.

The regular expression mask edits can:

Examples: Numbers, number ranges, dates, phone numbers, e-mail addresses, URLs, currency, and more.

TDIRegEx2MaskEdit TDIRegEx2MaskEdit

TDIRegEx2MaskEdit is an edit control that validates 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.

TDIRegEx2MaskComboBox TDIRegEx2MaskComboBox

TDIRegEx2MaskComboBox is a combo box control with essentially the same regular expression validation as TDIRegEx2MaskEdit. Additionally, it allows to select values from the combobox drop down.

Workbench Application

The YuPcre2 RegEx2 Workbench helps to design and test regular expressions. It allows to set options, measure execution times, and to save and load settings for later use.

The YuPcre2 RegEx2 Workbench is available as