Regular Expressions library for Delphi

Subscribe to RSS news feed

This "Swiss knife" library is a must have tool for any string parsing project.

unaRE.pas unit contains functions like rematch() and replace(), which take subject string and regex to match it with.

Here are some samples of regular expressions and matches:

Subject RegEx Matches :(.*): cid
1212121212121212 (12|21)*12*\1*12* 1212121212121212

To replace matches use replace() function, which can include backreferences:

Subject RegEx Substitution Result
8, 7, 6, 5, 4, 3, 2, 1 ([0-9]+),? \1 8 7 6 5 4 3 2 1 ^urn:cid:.+@([^\.]+\.)(.*)$ www.\2

In addition the unaRegExp class also defined in unaRE.pas unit provides an easy way for matching different strings with same RegEx avoiding its parsing.

Package includes two console samples which shows how to use the library.

Download full source code from our RegEx github repository.