Page 1 of 1

Preg_grep

Posted: Mon Oct 11, 2004 10:24 am
by Shendemiar
I will receive text from database, and i want to have some special items included there. Those i want to extract from the text.

Example data from database:
$A="Some text here some html tags like <br> and then the special element [link:id=1:type=txt]http:///www.a.b/c.txt[/link]someother text etc... maybe another special element";

I know i need to first seek for those special element with preg_gre, but those pattern thigns are too advanced for me. So How do i

Get "[link:id=1:type=txt]http:///www.a.b/c.txt[/link]" returned?

(Then i would like to replace the [link] element with some other php genereted text, eg. html link with some additional data.)

Posted: Mon Oct 11, 2004 1:11 pm
by mudkicker
There are many posts about this problem before. Do a search in forum ;)

Posted: Mon Oct 11, 2004 1:32 pm
by John Cartwright
[php_man]preg_match[/php_man], [php_man]preg_replace[/php_man] and [php_man]str_replace[/php_man]