Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-02

Which regex unit to use?

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

There are a few regex units include with FPC and Lazarus, and dozens more available for Delphi (and probably FPC too).

Which one is the most well known, or best to use, or most feature complete regarding syntax etc...?

* <fpcsrc>/packages/regexpr/src/old/regexpr.pp
* <fpcsrc>/packages/regexpr/src/regexp.pp
* <lazarus>/components/synedit/synregexpr.pas
* TRegExpr (no idea what is latest and if FPC compatible)
* ....?

I guess I'm looking for something similar or compatible with PCRE syntax, but in native Object Pascal, so it can be compiled into my applications.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys

Has anybody done a speed test between these two, to see how they perform with large test files?

* <fpcsrc>/packages/regexpr/src/regexp.pp

vs

* <lazarus>/components/synedit/synregexpr.pas * TRegExpr (no idea what is latest and if FPC compatible)
From the following link it sounds like TRegExpr is dog slow - even the

original author said so (referring that it was only meant for small lines of text).

http://z505.com/cgi-bin/qkcont/qkcont.cgi?p=TRegExpr%20Considered%20Harmful

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Seth Grover
Show quoted text 21 lines
Hi, There are a few regex units include with FPC and Lazarus, and dozens more available for Delphi (and probably FPC too). Which one is the most well known, or best to use, or most feature complete regarding syntax etc...? * <fpcsrc>/packages/regexpr/src/old/regexpr.pp * <fpcsrc>/packages/regexpr/src/regexp.pp * <lazarus>/components/synedit/synregexpr.pas * TRegExpr (no idea what is latest and if FPC compatible) * ....? I guess I'm looking for something similar or compatible with PCRE syntax, but in native Object Pascal, so it can be compiled into my applications. Regards, - Graeme -

I have had good luck with TRegExpr and have been using it in FPC for a long time.

-SG

This email is fiction. Any resemblance to actual events or persons living or dead is purely coincidental. Seth Grover sethdgrover[at]gmail[dot]com

Reply by email

Joost van der Sluis
to Graeme Geldenhuys: There are a few regex units include with FPC and Lazarus, and dozens more available for…
Graeme Geldenhuys wrote 10 lines
Hi, There are a few regex units include with FPC and Lazarus, and dozens more available for Delphi (and probably FPC too). Which one is the most well known, or best to use, or most feature complete regarding syntax etc...? * <fpcsrc>/packages/regexpr/src/old/regexpr.pp * <fpcsrc>/packages/regexpr/src/regexp.pp

use
<fpcsrc>/packages/regexpr/src/regex.pp

The regexp unit is a wrapper for backwards compatibility.

If you want to know something about speed, use the shootout. Although for some reason the implementation for regex-dna is not submitted to the shootout. But you can find the source in <fpcsrc>/tests/bench/shootout.

Joost

Reply by email