zrweber Posted December 31, 2010 Share Posted December 31, 2010 Alright, so I have a textarea where users can put in text. Everytime they put [ani] and click submit, I want the output to change [ani] into an html code: <img src="mypic.gif"> Is this possible? Link to comment https://forums.phpfreaks.com/topic/223067-search-string-for-a-tag-is-it-possible/ Share on other sites More sharing options...
Garethp Posted December 31, 2010 Share Posted December 31, 2010 You need something called Regular Expressions, which you give it a Pattern to search your text for, and a replacement string, and it does the work. In PHP, you use preg_replace($Pattern, $Replacement, $String) to do that. Here's some links to get you started The PHP documentation for Preg Replace http://php.net/manual/en/function.preg-replace.php A website to help teach Regular Expressions http://www.regular-expressions.info/ Another good tutorial to get you started http://www.phpfreaks.com/tutorial/regular-expressions-part1---basic-syntax Link to comment https://forums.phpfreaks.com/topic/223067-search-string-for-a-tag-is-it-possible/#findComment-1153292 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.