Recent

Author Topic: Test Regular Expressions  (Read 639 times)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1186
  • Professional amateur ;-P
Test Regular Expressions
« on: March 23, 2025, 06:37:24 pm »
Hey Y'All,

Project: Test Regular Expressions

This is an example on how to use regular expressions.

For simplicity's sake, I'm only demonstrating the Exec/ExecNext functionality. There's more to it than just these two, like the Substitute and Split functionalities.

I've also decided to use the RegExpr package that is provided in the packages that come by default with Free Pascal's compiler installation.
You can have a better picture of other options in this entry of the Wiki: Regular Expression Packages

You can find some documentation about TRegExpr here: TRegExpr Class.

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Thaddy

  • Hero Member
  • *****
  • Posts: 16823
  • Ceterum censeo Trump esse delendam
Re: Test Regular Expressions
« Reply #1 on: March 24, 2025, 09:04:02 am »
In recent trunk there is libpcre that provides bindings for the standard Perl Compatible Regular Expressions libraries (Ansi and Unicode versions).

I did not use it yet, though.
Expect this to be 100% pcre instead of the 99% compatibility of RegExpr, although the latter is pure pascal.

Added it to the wiki.
« Last Edit: March 24, 2025, 11:39:59 am by Thaddy »
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1186
  • Professional amateur ;-P
Re: Test Regular Expressions
« Reply #2 on: March 24, 2025, 06:16:31 pm »
Hey Thaddy,

Added it to the wiki.

Thanks !! Really appreciate the effort !!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Thaddy

  • Hero Member
  • *****
  • Posts: 16823
  • Ceterum censeo Trump esse delendam
Re: Test Regular Expressions
« Reply #3 on: March 24, 2025, 06:45:59 pm »
It is not complete yet.
I need to add where to find the correct binaries and since libpcre2 is versioned, provide a way to those correct binaries.
The committed version in trunk - not written by me - is libpcre version dependent and uses a version that is not current. Recent, but not current.
So it basically works, but it works for just a few: you need to build the binaries yourself. Few can...
That is not good enough yet.
Only recommend it for testing by very senior programmers.
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1186
  • Professional amateur ;-P
Re: Test Regular Expressions
« Reply #4 on: March 24, 2025, 07:42:00 pm »
Hey Thaddy,

It is not complete yet.
I need to add where to find the correct binaries and since libpcre2 is versioned, provide a way to those correct binaries.
The committed version in trunk - not written by me - is libpcre version dependent and uses a version that is not current. Recent, but not current.
So it basically works, but it works for just a few: you need to build the binaries yourself. Few can...
That is not good enough yet.
Only recommend it for testing by very senior programmers.

Gotcha, loud and clear!!

Will not touch it with a 10 feet barge pole until it's more mature!
Thanks for the warning !!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

 

TinyPortal © 2005-2018