Hi All
What will be the perfect Regular Expression to convert below mentioned 'Search
Text' to 'Replacement Text' while 'Single Line' option is ON.
When I use below mentioned Regex
index-entry(?:[^]+)?((?!\/index-entry).*?)/index-entry\s*pageId([0-9]+)/pageId
And replaces wrongly
index-entry
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Kprasad
Sent: 26 February 2010 15:56
To: perl-win32-users@listserv.ActiveState.com
Subject: Perl Regex
Hi All
What will be the perfect Regular Expression to
It looks like what u want to do is attribute folding. That's when u take a
nested XML tag and make it an attribute of an enclosing tag. Ur doing
something slightly different which is merging equal depth tags. The right
way to do this is with an XML parser. Look into XML::Simple to get started.
Here is the chunk of code which I used to perform this task:
open(XML, $ARGV[0]) or die Can not open $ARGV[0]: $!;
my $xmltext;
{
local $/ = undef;
$xmltext=XML;
}
close(XML);
while($xmltext=~
/index-entry(?:[^]+)?(?:.*?)\/index-entry(?:[^\n]*?)pageId([^]+)\/pageId/is)
{
$page=$2;