php - simple way to clean a bbcode url -
waht have:
have uploader generate links below : (this link on 1 line)
[url="http://mydomain.ir/direct.php?http://cdn1.mydomain.ir/up/137594098272081.jpg"][img]http://cdn1.mydomain.ir/up/thumbs/137594098272081.jpg[/img][/url]
link created 3 different data .
first , pagelink : http://mydomain.ir/direct.php
second, image : http://cdn1.mydomain.ir/up/137594098272081.jpg
third, thumb : http://cdn1.mydomain.ir/up/thumbs/137594098272081.jpg
what want :
want give 3 data array on simplest way (speedy way)
what's problem ? :
can use explode
function must fine function may big codes.
no better way clean links on simple , speedy way ? , example regx .
try this:
<?php $regex = '/\[url="(?<pagelink>(.*))\?(?<image>(.*))\"\]\[img\](?<thumb>(.*))\[\/img\]\[\/url\]/i'; $text = '[url="http://mydomain.ir/direct.php?http://cdn1.mydomain.ir/up/137594098272081.jpg"][img]http://cdn1.mydomain.ir/up/thumbs/137594098272081.jpg[/img][/url]'; preg_match($regex, $text, $matches); print_r($matches);
Comments
Post a Comment