regex vs synregexpr unit

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

regex vs synregexpr unit

Bihar Anwar
I've search fpc mailing list about this matter, I found they were discussed a long time ago (2006), and I still didn't have a conclusion about which one should be used. I need an advice about which unit should be used in terms of features, speed, etc.

Also, if someone here know a better approach to implement full-featured regular expression in our FPC programs, please let me know it.

Thanks in advance.



     

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

spir ☣
On Sat, 5 Jun 2010 09:54:51 -0700 (PDT)
Bihar Anwar <[hidden email]> wrote:

> I've search fpc mailing list about this matter, I found they were discussed a long time ago (2006), and I still didn't have a conclusion about which one should be used. I need an advice about which unit should be used in terms of features, speed, etc.
>
> Also, if someone here know a better approach to implement full-featured regular expression in our FPC programs, please let me know it.

Interested, too. And with a PEG library, if any (have searched, already); If there is none, I'll have to build one in a few weeks.

Denis
________________________________

vit esse estrany ☣

spir.wikidot.com
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

Schindler Karl-Michael-2
In reply to this post by Bihar Anwar
Hi

The pcre library (written in C) has a good reputation. You can get pascal headers from the Project JEDI Code Library (JCL).

Mischi_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

Bihar Anwar
In reply to this post by Bihar Anwar
Schindler Karl-Michael wrote on June 6, 2010 1:09:02 AM:
>The pcre library (written in C) has a good reputation. You can get
pascal headers from the Project JEDI Code Library (JCL).

Wow, that seems a more promising approach in the current time, I'll look on it. Thanks so much.

BTW, which approach should be used to call C functions from FPC: call them through DLL, or compile the C source into an .o file then link it with FPC code?


     
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

Graeme Geldenhuys-2
In reply to this post by Bihar Anwar
On 05/06/2010, Bihar Anwar wrote:
> I've search fpc mailing list about this matter, I found they were discussed
> a long time ago (2006), and I still didn't have a conclusion about which one

I have looked into this as well, about 2 months ago. From my initial
research it seems the regex unit included with FCL is not as
feature-complete as the one in SynEdit.

I found another Object Pascal implementation of regular expressions.
It is somewhere in my hard drive (can't remember the download link),
but I think it was similar in feature supported as the one in SynEdit.

I haven't done any speed comparisons to date.  I also know about the
CPRE library, but I want something implemented in Object Pascal to
compile into my applications.


--
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

Bugzilla from juha.manninen@phnet.fi
In reply to this post by Bihar Anwar
I also chose SynEdit for Lazarus Delphi converter for some reason. (I think it
was the first hit when searching "regexp" from Lazarus code base).
It works well.
I would guess the other choices work well, too.

About the speed difference: I don't believe there is any huge difference.
Please remember that if speed is really an issue for your application then you
must forget regexp and make your own pascal code to parse the string.

Juha
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

Bihar Anwar
On June 6, 2010 3:06:06 PM, Graeme Geldenhuys wrote:
> I have looked into this as well, about 2 months ago. From my initial
> research it seems the regex unit included with FCL is not as
> feature-complete as the one in SynEdit.

On June 6, 2010 3:54:53 PM, Juha Manninen wrote:
>I also chose SynEdit for Lazarus Delphi converter for some reason.
>I think it was the first hit when searching "regexp" from Lazarus
>code base. It works well. I would guess the others work well too.

Thanks Graeme and Juha for the information.

On June 6, 2010 3:54:53 PM, Juha Manninen wrote:
>Please remember that if speed is really an issue for your application
>then you must forget regexp and make your own pascal code to parse
>the string.

Speed is important to me, but reg-expr features is important as well.
Actually, I want to include reg-expr as an alternative search mode in
my general-purpose file search unit.


     
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

Bugzilla from juha.manninen@phnet.fi
Hi

> Speed is important to me, but reg-expr features is important as well.
> Actually, I want to include reg-expr as an alternative search mode in
> my general-purpose file search unit.

Then the SynEdit's version of regexp should be fast enough.
SynEdit editor in Lazarus for example uses it and it's quite fast.
File I/O is the slowest part when searching from files.

Juha
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

etrusco
http://delphi.about.com/od/toppicks/tp/delphi-regular-expressions.htm

The regex unit in SynEdit is an old version of the code from
regexpstudio.com (which seems to be offline) is said to be very slow
for processing large sets of data, like a whole file. In SynEdit it`s
used to process single lines, and in this situations it seems pretty
good.

Best regards,
Flavio


On Sun, Jun 6, 2010 at 12:32 PM, Juha Manninen <[hidden email]> wrote:

> Hi
>
>> Speed is important to me, but reg-expr features is important as well.
>> Actually, I want to include reg-expr as an alternative search mode in
>> my general-purpose file search unit.
>
> Then the SynEdit's version of regexp should be fast enough.
> SynEdit editor in Lazarus for example uses it and it's quite fast.
> File I/O is the slowest part when searching from files.
>
> Juha
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

Bihar Anwar
OK guys, after contemplating all your suggestions, I decide to follow the SynEdit way, that is, synregexpr unit. I suppose this unit tends to get more maintenance in the future.

Concerning the C++ PCRE library, it is the most full-featured reg-expr implementation, but calling C++ functions from FPC code in a cross-platform way is complex enough and causes of possible crash will be hard to investigate.

Cheers.



     
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: regex vs synregexpr unit

Joost van der Sluis
In reply to this post by Graeme Geldenhuys-2
On Sun, 2010-06-06 at 10:06 +0200, Graeme Geldenhuys wrote:
> On 05/06/2010, Bihar Anwar wrote:
> > I've search fpc mailing list about this matter, I found they were discussed
> > a long time ago (2006), and I still didn't have a conclusion about which one
>
> I have looked into this as well, about 2 months ago. From my initial
> research it seems the regex unit included with FCL is not as
> feature-complete as the one in SynEdit.

Bug-report numbers? ;)

As far as I know, the fcl-version follows the regex standard exactly and
completely. But the synedit version doesn't. You could try to run the
regexpr-tests from the fcl with the synedit version, see how it works.

But there are a lot of additions and regexp-dialect out there.

I thought that the main difference between the synedit regex and the
fcl-regex, is that the synedit version also supports the 'usual' search
patterns like '*'.

Joost.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal