[PHP] Re: stripping quotes within an image tag
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... hi how is it possible to strip quotes from an image tag ? i need IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 to look like IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 $string_no_quotes = str_replace('', '',$yourstring); if the tag can be placed in a variable/ -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stripping quotes within an image tag
? echo preg_replace('/(img.+?src=)([^]+)([^]*)/i', '\1\2\3', 'IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0'); ? Elias, Electroteque [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi how is it possible to strip quotes from an image tag ? i need IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 to look like IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stripping quotes within an image tag
that won't really work if he used the ALT attribute too: img alt=Hello world image src=helloworld.jpg David Robley [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... hi how is it possible to strip quotes from an image tag ? i need IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 to look like IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 $string_no_quotes = str_replace('', '',$yourstring); if the tag can be placed in a variable/ -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: stripping quotes within an image tag
On Wednesday 31 July 2002 20:34, lallous wrote: that won't really work if he used the ALT attribute too: img alt=Hello world image src=helloworld.jpg But stripping the 's makes it invalid HTML anyway. The OP got what (s/he) asked for. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Immutability, Three Rules of: (1) If a tarpaulin can flap, it will. (2) If a small boy can get dirty, he will. (3) If a teenager can go out, he will. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stripping quotes within an image tag
sick dude exactly what i needed , i have been doing php for a good while now but i have never hot my head around pregs :| Lallous [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ? echo preg_replace('/(img.+?src=)([^]+)([^]*)/i', '\1\2\3', 'IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0'); ? Elias, Electroteque [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi how is it possible to strip quotes from an image tag ? i need IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 to look like IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stripping quotes within an image tag
hmm sorry it didnt seem to work , it did then i gave it more than an img tag in a string and now it doesnt Lallous [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ? echo preg_replace('/(img.+?src=)([^]+)([^]*)/i', '\1\2\3', 'IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0'); ? Elias, Electroteque [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi how is it possible to strip quotes from an image tag ? i need IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 to look like IMG height=44 alt=hspace=0 src=blah.jpg width=148 border=0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: stripping quotes within an image tag
On Wednesday 31 July 2002 20:38, electroteque wrote: hmm sorry it didnt seem to work , it did then i gave it more than an img tag in a string and now it doesnt If all you're doing is stripping the double-quotes why don't you use str_replace() as someone suggested? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Denver, n.: A smallish city located just below the `O' in Colorado. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: stripping quotes within an image tag
easy done but then it would replace all matches ie blah in the content would be removed :| it worked when i did $string = img height=\44\ alt=\\ hspace=\0\ src=\blah.jpg\ width=\148\ border=\0\; but when i do $string =table class=\tablecontent\ cellspacing=\0\ cellpadding=\10\ width= \100%\ border=\0\ tbody tr tda href=\blah.php\ target=\_blank\img height=\44\ alt=\\ hspace=\0\ src= \blah.jpg\ width=\148\ border=\0\/a/td tdView your account information. This option is only available to investors who have authorised us to make this facility available. Please contact us if you wish to have enquiry access to your data./td /tr /tbody /table; this doesnt work using this echo preg_replace('/(img.+?src=)([^]+)([^]*)/i', '\1\2\3', $string); Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wednesday 31 July 2002 20:38, electroteque wrote: hmm sorry it didnt seem to work , it did then i gave it more than an img tag in a string and now it doesnt If all you're doing is stripping the double-quotes why don't you use str_replace() as someone suggested? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Denver, n.: A smallish city located just below the `O' in Colorado. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php