Pascal and regexes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Pascal and regexes

Mark Morgan Lloyd-5
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


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. .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
fpc-pascal maillist  -  [hidden email]