in reply to Regular Expression Help Help
So here is my take on the problem:
use strict; use warnings; my $location = "1"; my $obj_name = "Stock3of1"; { local $/ = "\n\n"; while ( <DATA> ) { if ( /<\?--([^-]*)-([^-]*)-->(.*?)<\/\?--([^-]*)-([^-]*)-->/s ) { print unless ( $location eq $1 and $obj_name eq $2); } } } __DATA__ <?--1-News1--> <b>This is option News 1 of 1</b> </?--1-News1--> <?--1-Weather2of1--> <b>This is option Weather 2 of 1</b> </?--1-Weather2of1--> <?--1-Stock3of1--> <b>This is option Stock 3 of 1</b> </?--1-Stock3of1--> <?--2-Second1of2--> <b>Option Second 1 of 2</b> </?--2-Second1of2--> <?--3-Third1of3--> <b>Option Third 1 of 3</b> </?--3-Third1of3-->
I believe this does what you wanted.
-Enlil
|
|---|