Re: otra de expresiones regulares
| From: | Rafael | Date: | Tue, 20 Jun 2006 12:32:20 +0000 |
| Subject: | Re: otra de expresiones regulares | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-59142@lists.php.net to get a copy of this message | ||
Al igual que preg_match(), esta función busca la primer coincidencia. Si quieres encontrarlas todas deberás hacer un ciclo, o utilizar un equivalente a preg_match_all() --no sé si lo haya-- o sustituir eregi()
Del manual...
"Returns the length of the matched string if a match for pattern was found in string, or FALSE if no matches were found or an error occurred. If the optional parameter regs was not passed or the length of the matched string is 0, this function returns 1."
Javier Martinez wrote:
Tengo esta expresion que en un programita me devuelve varias cadenas, y en este comando, solo me devuelve 1 --------------------------------------------------------------------------------------------------------------- eregi("&([a-z]*)", "Usuario &nombre (&usuario) encontrado", $coincidencias); --------------------------------------------------------------------------------------------------------------- porque $coincidencias me devuelve esto? Array ( [0] => &nombre [1] => nombre ) No deberia devolverme esto? Array ( [0] => &nombre [1] => nombre [2] => usuario ) -- Atentamente / Sincerely, J. Rafael Salazar Magaña