in reply to Re: split/matching/regex question
in thread split/matching/regex question
This will interleave the data with the numbers from the delimiter.my @entries = $longstring =~ /(.*?)(?:<!--NEWENTRY(\d+)-->)/g;
Update: Thanks to kvale for pointing out that this drops trailing data. I cannot come up with a foolproof fix using only a pattern match capture. This one will keep all data, but will tack on a phantom (empty) delimiter entry if the line ends with data:
my @entries = $longstring =~ /(.*?)(?:<!--NEWENTRY(\d+)-->|$)/g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: split/matching/regex question
by kvale (Monsignor) on Apr 14, 2004 at 20:29 UTC |