Skip to content


Demo code for TRegExpr


If you don't familiar with regular expression, please, take a look at the r.e.syntax.

TRegExpr interface described in TRegExpr interface.


Text2HTML sources

Publish plain text as HTML

Uses unit HyperLinksDecorator that is based on TRegExpr.   This unit contains functions to decorate hyper-links.

For example, replaces with <a href=""></a> or with <a href=""></a>.   .. code-block:: pascal

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

) : string;

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

TDecorateURLsFlagSet = set of TDecorateURLsFlags;

function DecorateEMails (const AText : string) : string;  

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)

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 AFlags is [durlAddr] then hyper link will be decorated as <a href=""></a>.


Very simple examples, see comments inside the unit


Slightly more complex examples, see comments inside the unit