Does this have to be hard coded in to the script? Just wondering since I have been kinda following this thread.


Feb 26, 2010 01:56:02 PM, perl-win32-users-boun...@listserv.activestate.com wrote:
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.
U would read in the XML to a hash, manipulate the data in the hash, and then
write out a new XML file.

Regex can do this in a degenerate case but it becomes unmanageable fast.
But since u asked....

$xml =~
s{(\s*)([^<]*)\s*([^<]*)eId>(\s*)}{$1pages="$3">$2$4}sg;

HTH


At 09:25 PM 2/26/2010 +0530, Kprasad wrote:
>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 disordershref="" label="see">disorders of arousal
>
>.....................
>
>Search Text:
>
>
>APOE e4 variant 18
>

>
>arousal disorders label="see">disorders of arousal
>

>
>arterial blood gas tests 32
>

>
>asthma 28--9, 295
>

>
>Correct Replacement Text should be:
>
>
>APOE e4 variant
>

>
>arousal disorders label="see">disorders of arousal
>

>
>arterial blood gas tests
>

>
>asthma
>

>


--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to