PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > preg_match_all issue, need some
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
preg_match_all issue, need some

Réponse
 
LinkBack Outils de la discussion
Vieux 28/02/2008, 02h35   #1
dysfunct
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut preg_match_all issue, need some

I'm running a script that at one point will collect <img> tags from
some html. I've been using the following:

preg_match_all("/<img .*?>/",$html,$images);

and I thought it was working well. However, I've notice that some
things i throw at it don't work properly. It seems to be that and
image tag closing itself with "/>" doesn't work, ie <img src=".....
" /
>. I'm guessing the "/" character is delimiting the regex somehow.


Admittedly I know very little about regular expressions. Anyone know
whats going on and the best way to get all the image tags? I ideally
would like the whole thing, from the <img to the final closing bracket
  Réponse avec citation
Vieux 28/02/2008, 14h17   #2
petersprc
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: preg_match_all issue, need some

Hi,

If the tag spans multiple lines you'll need the dot all option (insert
an s after the last / delimiter).

Regards,

John Peters

On Feb 27, 8:35 pm, dysfunct <Dysfunct...@gmail.com> wrote:
> I'm running a script that at one point will collect <img> tags from
> some html. I've been using the following:
>
> preg_match_all("/<img .*?>/",$html,$images);
>
> and I thought it was working well. However, I've notice that some
> things i throw at it don't work properly. It seems to be that and
> image tag closing itself with "/>" doesn't work, ie <img src=".....
> " /
>
> >. I'm guessing the "/" character is delimiting the regex somehow.

>
> Admittedly I know very little about regular expressions. Anyone know
> whats going on and the best way to get all the image tags? I ideally
> would like the whole thing, from the <img to the final closing bracket


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h37.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09694 seconds with 10 queries