RegEx Multi-Match Anchor -- Does It Exist?
| From: | Waldo L. Jaquith | Date: | Tue, 01 Aug 2000 04:39:27 +0000 |
| Subject: | RegEx Multi-Match Anchor -- Does It Exist? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9351@lists.php.net to get a copy of this message | ||
Folks,
I'm looking for a way to pick up in an ereg where I left off. A while-loop
type thing, like Perl's \G anchor. A search on the list revealed only Jim
Kraai's <jkraai@polytopic.com> posting on 02-08-92
<http://marc.theaimsgroup.com/?l=php-general&m=91845718525786&w=2>,
which
provided this:
> function mult_ereg($pat,$string)
> {
> $sep = "~~~sep~~~";
> $newstring = ereg_replace("($pat)",$sep.'\\1'.$sep,$string);
> $ary = split($sep,$newstring);
> for ($i=1,$numRegs=count($ary);$i<$numRegs;$i+=2)
> $parts[] = $ary[$i];
> return $parts;
> }
Is this pretty much where we're at now, or is there a native PHP function to
do this? I'll be awfully surprised to find out that there's no basic PHP
function to perform this -- it seems like something that would be in a lot
of demand!
Thanks, folks.
Best,
Waldo
Waldo L. Jaquith
< waldo@munkandphyber.com >
< 804/979.2980 >
// Munk & Phyber
// 110B Second Street NE
// Charlottesville, VA 22902