Re: Perl Regex

2010-02-26 Thread Kprasad
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=; } close(XML); while($xmltext=~ /]+)?>(?:.*?)<\/index-entry>(?:[^\n]*?)([^<]+)<\/pageId>/is) { $page=$2; $page=~ s/ *\n

Re: Perl Regex

2010-02-26 Thread Chris Wagner
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.

RE: Perl Regex

2010-02-26 Thread Brian Raven
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 conv

Perl Regex

2010-02-26 Thread Kprasad
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>).*?)\s*([0-9]+) And replaces wrongly arousal disordersdisorders of arousal