tshabet has asked for the wisdom of the Perl Monks concerning the following question:
and<heading level=2> Introduction to Arguments</heading>
And I would like to integrate the "level" attribute into the <heading> tag, so that the first would become<heading> <index primary-key="procedures" secondary-key="definition, rest ar +guments in"/> <index primary-key="rest arguments" secondary-key="specifying, in +procedure definition"/> level=3, Specifying Rest Arguments in a Procedure Definition</heading>
and the second would become<heading2> Introduction to Arguments</heading2>
To do this I've written a regex which, unfortunately, fails to work. Here's my regex:<heading3> <index primary-key="procedures" secondary-key="definition, rest ar +guments in"/> <index primary-key="rest arguments" secondary-key="specifying, in +procedure definition"/> Specifying Rest Arguments in a Procedure Definition</heading3>
Any hints on where my logic goes astray? Thanks for any and all info, sorry to bother everyone with such a simple question.$text =~ s/<heading([^(<\/heading>)]*?)level=(.{1})([^(<\/heading>)]*? +)<\/heading>/<heading$2>$1$3<\/heading$2>/gsix;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: Regex for XML attributes...
by jeffa (Bishop) on Aug 23, 2001 at 23:39 UTC | |
by tshabet (Beadle) on Aug 23, 2001 at 23:54 UTC | |
by jeffa (Bishop) on Aug 24, 2001 at 00:00 UTC | |
by tshabet (Beadle) on Aug 24, 2001 at 02:24 UTC | |
|
Re: Regex for XML attributes...
by mirod (Canon) on Aug 23, 2001 at 23:57 UTC |