Re: Re: Put text matching regex into array?

From: Date: Wed, 18 Dec 2002 13:42:07 +0000
Subject: Re: Re: Put text matching regex into array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128709@lists.php.net to get a copy of this message
At 13:39 18-12-02 +0000, achillex wrote:
eurleif@buyer-brokerage.com (Leif K-Brooks) wrote in news:3DFE7849.5050102 @buyer-brokerage.com: Is there a way to put each part of a string matching a regex into an array? Example: $string = "-----_-_--- --_-_-- random text here-_"; $array = regextoarray($string,"[-_]{1,}"); //Produces array of "-----_-_---","--_-_--","-_" if (Preg_Match_All('~([-_]+)~S', $string, $matches)) {
        var_dump($matches);
}
or try ereg () with third argument. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#128709) next »