Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
Here i need some help in split.
Input:
<AU>PAUL A. HUBBARD,<SUP>1</SUP> WENFENG YU,<SUP>2</SUP> HORST SCHULZ,<SUP>2</SUP> JUNG-JA P. KIM<SUP>1</SUP></AU>
output:
<contribgroup> <contributor>PAUL A. HUBBARD<SUP>1</SUP></contributor> <contributor>WENFENG YU<SUP>2</SUP></contributor> <contributor>HORST SCHULZ<SUP>2</SUP></contributor> <contributor>JUNG-JA P. KIM<SUP>1</SUP></contributor> </contribgroup>
In the input the <SUP>(.*?)</SUP> is optional.
So i tried using split , and retaining <SUP> . my @au = map '<contributor">'.$_.'</contributor>', split /(,|(?=<\/SUP>)) /, $au;or is there anyother easy way to do it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: split with '|'
by ikegami (Patriarch) on Apr 22, 2005 at 05:56 UTC | |
by Anonymous Monk on Apr 22, 2005 at 06:02 UTC | |
by ikegami (Patriarch) on Apr 22, 2005 at 06:22 UTC | |
by Anonymous Monk on Apr 22, 2005 at 06:31 UTC | |
|
Re: split with '|'
by jbrugger (Parson) on Apr 22, 2005 at 06:14 UTC | |
|
Re: split with '|'
by Anonymous Monk on Apr 22, 2005 at 05:58 UTC | |
by ikegami (Patriarch) on Apr 22, 2005 at 06:29 UTC | |
by jbrugger (Parson) on Apr 22, 2005 at 06:33 UTC | |
by thor (Priest) on Apr 22, 2005 at 09:39 UTC |