Preg_grep

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Preg_grep

Post 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.)
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

There are many posts about this problem before. Do a search in forum ;)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

[php_man]preg_match[/php_man], [php_man]preg_replace[/php_man] and [php_man]str_replace[/php_man]
Post Reply