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 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/