[Lazarus] use of function ExtractWord

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Tue Sep 15 16:15:23 CEST 2015


On 2015-09-15 14:46, John Landmesser wrote:
> If i want to extract '(813 KB/s)', i have to extract the SECOND word!!

Michael already explained it.

I would rather opt to use regex to extract the exact piece of text you
are interested in. FPC includes a capable regex implementation.

  regex string:   ⸢\((\d+\w.*/s)\)⸥

  and you should be able to reference the value between '(' and ')' with
the first matching group... normally referenced as ⸢\1⸥

ps:
  The text between ⸢ and ⸥ are the regex syntax.



Regards,
  - Graeme -

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




More information about the Lazarus mailing list