Sign in Join

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

Mailing lists / fpc-pascal / 2001-06

regular expressions vs. replace in string

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Martin Hankovec

Hello all,
I have, please, a question. Is any way to use regular expressions in FPC? Or - better - I need to replace some words in string with another and count the occurence of these words. Whast's the best way to do it? Any word is bounded with non-word characters (space,&,<,>, , . etc.), so I cannot use the function POS directly. And looking for these characters in string char by char is quite slow.

Thanks for advice and wish you a nice day.

Martin H.

Reply by email

Jonas Maebe
to Martin Hankovec
Martin Hankovec wrote
I have, please, a question. Is any way to use regular expressions in FPC?

There is a unit called "regexpr" in the packages (you can download them separately from the website if you don't have them). It's not documented however and personally I have never used it, so you'll have to look at its sources to find out how it works.

Jonas

Reply by email