Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want the output to be<entry>22<?Pub _hardspace?>AWG or larger</entry>
(Yes, it is XML, and no , I am not using XML::Simple - I am fighting a different battle trying to install that!) So, I am using this relatively simple search and replace<entry><xx>22 AWG</xx> or larger</entry>
but it's coming out a little incorrect asperl -pi -e 's/(\S+)<\?Pub \_hardspace\?\>(\S+)/<xx\>$1 $2<\/xx\>/gs' +test
ie the <xx> is starting too early - I'm matching a word with the "S" so maybe that is matching '<entry>22' rather than just 22 ?? Any ideas ? The character immediately preceeding could be anything, not just '>' ...<xx><entry>22 AWG</xx> or larger</entry>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reg expression needs a tweek
by jethro (Monsignor) on Mar 15, 2010 at 17:38 UTC | |
|
Re: reg expression needs a tweek
by JavaFan (Canon) on Mar 15, 2010 at 17:30 UTC | |
|
Re: reg expression needs a tweek
by Anonymous Monk on Mar 15, 2010 at 17:28 UTC | |
|
Re: reg expression needs a tweek
by Anonymous Monk on Mar 16, 2010 at 07:58 UTC |