develooper Front page | perl.recdescent | Postings from September 2009

Help with a grammar problem

Thread Next
From:
Mike Diehl
Date:
September 1, 2009 19:32
Subject:
Help with a grammar problem
Message ID:
200909012033.23087.mdiehl@diehlnet.com
Hi all,

I'm struggling with an RD grammar problem and am hoping you can help.

I've got some data that is embedded inside a file and I need to parse only the 
embedded data and leave the "noise" untouched.

For example:

afaf asf af <DELIMITER> command command command </DELIMITER> asdf asd qer f a

I want to parse the command(s), remove the DELIMITERS and preserve everything 
else.

In the past, I've looped over the file with a regex looking for the delimeters 
and then running RD on the text inside.  However, the cost of launching 
several instances of the parser is very expensive, about 80% of runtime.

I'd like to be able to use one parser and have it "do" the entire file.

What I've tried amounts to this:

chunk: /.*?/ delimiter_start command(s) delimiter_end /.*?/

However, I think the first regex is eating too much.

Any suggestions on how to do this?

TIA.

-- 

Take care and have fun,
Mike Diehl.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About