On Fri, Oct 10, 2008 at 9:49 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> Sharan Basappa wrote:
>>
>> I am trying to process a code for some processing.
>> The code looks like
>>
>> keywordx ...
>>
>> keywordy identifier_a
>> some text
>> endkeywordy
>>
>> keywordz identifier_a
>> some text
>> endkeywordz
>>
>> endkeywordx
>>
>>>From this, I would like to extract text starting from keywordy and
>>>endkeywordy.
>> Is using text balanced module the right way to go?
>> An example with or without text-balanced module would be really helpful ...
>
> If your problem really is that simple, and you don't expect 'keywordy' blocks
> to
> be nested inside other 'keywordy' blocks, then the program below will do what
> you need.
>
> It may help if you showed us some actual data so that we could get a better
> insight into how it behaves.
>
> HTH,
>
> Rob
>
>
> use strict;
> use warnings;
>
> while (<DATA>) {
> print if /\bkeywordy\b/ .. /\bendkeywordy\b/;
> }
>
> __DATA__
> keywordx ...
>
> keywordy identifier_a
> some text
> endkeywordy
>
> keywordz identifier_a
> some text
> endkeywordz
>
> endkeywordx
>
Thanks, Rob. I will give a try with this code. But given that there
are new lines between keyword and endkeyword,
do you think it will work.
Regards
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/