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:
urn:cid:199606121851.1@bar.example.com |
:(.*): |
cid |
1212121212121212 |
(12|21)*12*\1*12* |
1212121212121212
12121212121212
121212121212
1212121212
12121212
121212
1212
|
To replace matches use replace() function, which can include backreferences:
8, 7, 6, 5, 4, 3, 2, 1 |
([0-9]+),? |
\1 |
8 7 6 5 4 3 2 1 |
urn:cid:199606121851.1@bar.example.com |
^urn:cid:.+@([^\.]+\.)(.*)$ |
www.\2 |
www.example.com |
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.