[PHP]REGEX pour interprété une url complexe
Fermé
maxwells
Messages postés
25
Date d'inscription
lundi 3 janvier 2005
Statut
Membre
Dernière intervention
24 juin 2008
-
21 août 2007 à 18:58
Moua - 21 août 2007 à 20:56
Moua - 21 août 2007 à 20:56
A voir également:
- [PHP]REGEX pour interprété une url complexe
- Lien url - Guide
- Easy php - Télécharger - Divers Web & Internet
- Atlas pro url serveur invalide - Forum TV & Vidéo
- Ping url ✓ - Forum Windows
- Verifier une adresse url - Guide
1 réponse
Si tu veux, je peux te sortir un truc comme ca :
c'est grâce à ca :
Attention, remplace un :alnum: par [ [ : a l n u m : ] ]
Array ( [0] => https://www.google.fr/search?q=regex+pour+interpr%C3%A9ter+une+url+complexe&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_frFR213FR213&gws_rd=ssl [1] => http [2] => ht [3] => www.google.fr [4] => Array ( [0] => q=regex+pour+interpr%C3%A9ter+une+url+complexe [1] => sourceid=navclient-ff [2] => ie=UTF-8 [3] => rlz=1B3GGGL_frFR213FR213 ) )
c'est grâce à ca :
$test = "https://www.google.fr/search?q=regex+pour+interpr%C3%A9ter+une+url+complexe&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_frFR213FR213&gws_rd=ssl"; $pattern = '/((ht|f)tps?):\/\/(:alnum:+[.[:alnum:]]*\.[a-zA-Z]{2,4})\/[.[:alnum:]]*\?(.*)/'; preg_match($pattern, $test, $array); $array[4]=explode("&", $array[4]); print_r($array);
Attention, remplace un :alnum: par [ [ : a l n u m : ] ]