TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   a question can i input html in a preg_replace (http://www.talkphp.com/absolute-beginners/3121-question-can-i-input-html-preg_replace.html)

codefreek 07-14-2008 10:59 PM

a question can i input html in a preg_replace
 
PHP Code:

$imgsrc preg_replace('/^.*?(<img [^>]*?src="([^"]+)"[^>]*>).*$/is','\2',$item->description); 


so can you input html into that?

delayedinsanity 07-14-2008 11:26 PM

You can do almost anything you want with regular expressions, except make cappucino.
-m

drewbee 07-14-2008 11:31 PM

Yeah? Regex is all about patterns. the idea that you are parsing html is irrelevant.

codefreek 07-15-2008 01:15 AM

so i could do this <br><p>$item->description</p>); ? inside the preg_.

drewbee 07-15-2008 03:32 AM

Sure, if that is what your trying to match. Im not to sure where your headed with this, because that statement doesn't really make sense to me.

But you could match "<br><p>$item->description</p>);" with regex if you wanted.

codefreek 07-15-2008 12:32 PM

thank you.
i fixed it already :P

drewbee 07-15-2008 02:52 PM

I can honestly say I have no idea what just happened in this thread. lol. You have officially confused me to no end and off the edge of the earth :D

codefreek 07-15-2008 05:31 PM

i asked a question and you answered on a point and i tested and i fixed
not that hard to understand.


All times are GMT. The time now is 07:02 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0