cormanaz has asked for the wisdom of the Perl Monks concerning the following question:
I try to split it with the regex (<\/p>)?\s*<p> and what I get is a list with elements:<p>Paragraph 1</p> <p>Paragraph 2</p> <p>Paragraph 3</p>
I understand why the last element has the close paragraph tag in there, but why are there elements between the paragraph ones with a close paragraph tag? I thought split was supposed to split on whatever it matches, and I know it matches the </p><p> sequence.(null) Paragraph 1 </p> Paragraph 2 </p> Paragraph 3</p>
TIA
Steve
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Don't understand behavior of this split
by moritz (Cardinal) on Aug 26, 2010 at 14:25 UTC | |
|
Re: Don't understand behavior of this split
by ikegami (Patriarch) on Aug 26, 2010 at 14:31 UTC | |
|
Re: Don't understand behavior of this split
by kennethk (Abbot) on Aug 26, 2010 at 14:26 UTC | |
|
Re: Don't understand behavior of this split
by TomDLux (Vicar) on Aug 26, 2010 at 14:28 UTC | |
|
Re: Don't understand behavior of this split
by Corion (Patriarch) on Aug 26, 2010 at 14:26 UTC | |
|
Re: Don't understand behavior of this split
by psini (Deacon) on Aug 26, 2010 at 14:28 UTC |