How I would do (because I love regular expressions):
I installed the full latest fpc, but somehow the RegExpr unit is missing when trying your code.
Looking online, there seems to be several versions by different authors floating around, so I need to know which regular expression unit you used as I dont want to risk chasing false bugs.
Is there an fpc units package I maybe miss where RegExpr unit is included ?
Looking in my system directory where 3.2.2 is installed I get,
find |grep -i reg |grep -i ppu
./3.2.2/units/i386-linux/fcl-fpcunit/testregistry.ppu
./3.2.2/units/i386-linux/regexpr/uregexpr.ppu
./3.2.2/units/i386-linux/regexpr/oldregexpr.ppu
./3.2.2/units/i386-linux/regexpr/regexpr.ppu
./3.2.2/units/i386-linux/regexpr/regex.ppu
./3.2.2/units/i386-linux/fcl-registry/xmlreg.ppu
./3.2.2/units/i386-linux/fcl-registry/registry.ppu
./3.2.2/units/i386-linux/fcl-db/fpddregstd.ppu
./3.2.2/units/i386-linux/googleapi/googleserviceregistry.ppu
./3.2.2/units/x86_64-linux/fcl-fpcunit/testregistry.ppu
./3.2.2/units/x86_64-linux/regexpr/uregexpr.ppu
./3.2.2/units/x86_64-linux/regexpr/oldregexpr.ppu
./3.2.2/units/x86_64-linux/regexpr/regexpr.ppu
./3.2.2/units/x86_64-linux/regexpr/regex.ppu
./3.2.2/units/x86_64-linux/fcl-registry/xmlreg.ppu
./3.2.2/units/x86_64-linux/fcl-registry/registry.ppu
./3.2.2/units/x86_64-linux/fcl-db/fpddregstd.ppu
./3.2.2/units/x86_64-linux/googleapi/googleserviceregistry.ppu
./2.0.4/units/i386-linux/regexpr/regexpr.ppu
./2.0.4/units/i386-linux/fcl/xmlreg.ppu
./2.0.4/units/i386-linux/fcl/testregistry.ppu
./2.0.4/units/i386-linux/fcl/registry.ppu
So there are regular expression units as installed but somehow what your function asks for is not covered by these units.