preg_match_all : not all regular expressions ?

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: preg_match_all : not all regular expressions ?
Groups: php.general 
Request: Send a blank email to php-general+get-175747@lists.php.net to get a copy of this message
[newbie, please help] I'm trying to extract all URLs mentionning sound files from blocks of texts. I first tried with ereg and the following code works fine : $texte='TEST FIND<br>\net voici un fichier son http://serveur/repertoire/fichier.gig ou ftp://serveur/repertoire/fichier.snd et ftp://serveur/repertoire/fichier.mp3 la suite http://serveur/repertoire/fichier.wav de mon texte'; if (ereg("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]\.(mp3|snd|wav)", $texte, $regs)) {
       echo $regs[0]."<br>\n";
} else {
       echo "pas trouv&eacute;<br>\n";
} the only problem is that it will only extract the first URL, so I did a small modification to use preg_match_all : if (preg_match_all("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]\.(mp3|snd|wav)", $texte, $matches)) {
       for ( $i=0 ; $i < count($matches[0]) ; $i++ ) {
           echo $matches[0][$i]."<br>\n" ;
       }
} else {
          echo "pas trouv&eacute;<br>\n";
} but I have the following error message : *Warning*: Unknown modifier '+' in *e:\program files\easyphp1-7\www\test_ereg.php3* on line *4* where line 4 is the line with the regular expression after preg_match_all What's that ?

« previous php.general (#175747) next »