First of all I recommend You to read article with usage illustrations.

Ready to run Windows application REStudio to learn and debug regular expressions.

Please, note that there are localized demos available (with comments in source code on national languages).

This localized versions distributed in localized full TRegExpr packages, and in separate localized documentation packages (when You unpack this documentation package in TRegExpr directory the localized demos overwrite English ones).


very simple examples, see comments inside the unit


slightly more complex examples, see comments inside the unit


see description

If You don’t familiar with regular expression, please, take a look at the r.e.syntax topic.

TRegExpr interface described in TRegExpr interface.


Some of demo-projects use extended VCL properties which exists only in Delphi 4 or higher. While compiling in Delphi 3 or Delphi 2 you’ll receive some error messages about unknown properties. You may ignore it

  • this properties is needed only for resizing and justification of components then form change it’s size.


Very simple utility, that helps publish plain text as HTML

Uses unit HyperLinksDecorator that is based on TRegExpr.


Specially written as a demonstration of TRegExpr usage.


Unit HyperLinksDecorator

DecorateURLs   DecorateEMails

This unit contains functions to decorate hyper-links (see Text2Html demo-project for usage example).


For example, replaces ‘’ with ‘’ or ‘[email protected]’ with ‘[email protected]’.


function DecorateURLs


Finds and replaces hyper links like ‘http://…’ or ‘ftp://..’ as well as links without protocol, but start with ‘www.’ If You want to decorate emails as well, You have to use function DecorateEMails instead.


function DecorateURLs (const AText : string; AFlags : TDecorateURLsFlagSet = [durlAddr, durlPath]) : string;




Returns input text AText with decorated hyper links.


AFlags describes, which parts of hyper-link must be included into VISIBLE part of the link:

For example, if [durlAddr] then hyper link ‘’ will be decorated as ‘



TDecorateURLsFlags = (durlProto, durlAddr, durlPort, durlPath, durlBMark, durlParam);

TDecorateURLsFlagSet = set of TDecorateURLsFlags;




These are the possible values:


Value                Meaning

durlProto        Protocol (like ‘ftp://’ or ‘http://’)

durlAddr        TCP address or domain name (like ‘’)

durlPort                Port number if specified (like ‘:8080’)

durlPath        Path to document (like ‘index.html’)

durlBMark        Book mark (like ‘#mark’)

durlParam        URL params (like ‘?ID=2&User=13’)





function DecorateEMails


Replaces all syntax correct e-mails with ‘ADDR’. For example, replaces ‘[email protected]’ with ‘[email protected]’.


function DecorateEMails (const AText : string) : string;




Returns input text AText with decorated e-mails


Usage illustrations

Text processing from bird’s eye view