[fpc-pascal] Pascal and regexes
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Mon Feb 19 13:57:41 CET 2007
I'm using TRegex to process stuff that I'm receiving from an RS232 port,
actually connected to a Tek 'scope. If I have an incoming message like
ACQ:08080E3150;
and apply a regex such as ACQ:(..){5}; I get a single match which is 50.
If instead I use ACQ:(..)(..){4}; I get two matches 08 and 50, while if I use
ACQ:(..)((..){4}); I get 08 and 080E3150.
Can anybody see a way of either specifying a regex where the number of matches
is the same as the number of subexpressions matched by a value in braces etc.,
or of pulling it out of the regex object after the match? This obviously isn't
significant in the above case where there's a small amount of input, but it
would be nice to be able to match a fixed-size block of data by using something
like (..}{512}.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list