Re: preg_match_all to match <img> tags

From: Date: Sat, 11 Aug 2007 20:57:23 +0000
Subject: Re: preg_match_all to match <img> tags
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-260710@lists.php.net to get a copy of this message
Ive already finished the code and pasted it to this mailing list :) Just an fyi. Ólafur Waage > 2007/8/11, Tijnema <tijnema@gmail.com>: > > On 8/11/07, Stut <stuttle@gmail.com> wrote: > > > Tijnema wrote: > > > > On 8/11/07, Richard Heyes <richardh@phpguru.org> wrote: > > > >> Richard Heyes wrote: > > > >>>> How can i match an image tag correctly so it does not cause any > > > >>>> issues > > > >>>> with how the user adds the image. > > > >>> preg_match_all('/<img[^>]*>/Ui'); > > > >>> > > > >>> Off the top of my head. This wouldn't allow for using the right > > > >>> angle > > > >>> bracket in the img tag, but that's almost never going to happen in > > > >>> reailty. > > > >> Oops that should be: > > > >> > > > >> preg_match_all('/<img[^>]*>/Ui', $input, $matches); > > > >> > > > >> -- > > > >> Richard Heyes > > > > > > > > < img src="image.jpg"> > > > > > > > > Your script doesn't catch above ;) > > > > > > That's not valid HTML and won't get displayed correctly in most browsers. > > > > > > -Stut > > > > hmm.. damn.. you're right :P I always assumed it was just correct... > > > > Tijnema > > -- > > Vote for PHP Color Coding in Gmail! -> > > http://gpcc.tijnema.info > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >

« previous php.general (#260710) next »