Log in

View Full Version : [REGEX-Cleaner.php] Replace all bbcode with a certain url


Ghostt
07-01-2010, 12:51 AM
hi,
i have a problem with the REGEX and cleaner.php from impex tools.

what i want is to change the BBCode of all images which have the "example.com" url to [AME] BBCode

[IMG]http://example.com/img/cbhdgvgdqarb.jpg to -->>

http://example.com/img/cbhdgvgdqarb.jpgso this is my idea, but dont work:

$text = preg_replace('#(http.*example\.com.*)\[/img:[a-z0-9]+\]#siU', 'h$1', $text);are here experts that can fix this to a clean regexcode`?

Scootz
07-01-2010, 01:34 AM
As far as I know, preg_replace() needs the regexp surrounded by slashes. Your regexp seems a little malformed as well. Try this:

$text = preg_replace('/\[img\](http:\/\/w?w?w?\.?example\.com\/?.*)\[\/img\]/i', '$1', $text);

I tested it and it works. :)

ChopSuey
07-01-2010, 04:47 AM
Your best asking for help in the modification thread.

Ghostt
07-01-2010, 07:59 PM
yes thanks Scootz ! it worked