On Thu, Oct 19, 2000 at 06:04:29PM +0100, Dermot McGahon wrote:
> Can MB1 and MB2 be contained within <data>. If not then you should
> just use the fact that they are always there and match up to them.
They can, in principle, but they never will be, in practice.
> Untested. If you send on sample data I will test this or other
> solutions I may come up with:
>> while (/$MB1$MB2(.)..(.*)(?!$MB1$MB2)/) { $data{$1} = $2 }
This is a nice Perlish solution, but unfortunately it won't work because the
last <data> won't have MB1,MB2 after it :-(
I ended up using something like this
while ($buffer =~ /($MB1$MB2)([$markers])(..)/g) {
$length = unpack("n", $3);
$item = $2;
$buffer =~ /(.{$length})/g;
$data{$item} = $1;
}
but I really had hoped that I could mangle the two regex and the length
calculation into one regex - apparently it may be possible in 5.6.
Regards,
Niall
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!