Reputation: 2204
If i have the string [link="*"]
where * is a wildcard how could i then use php to replace the string with <a href="*">
where * is the same value as before?
Is preg_replace the best way to do this?
Thanks, any help appreciated!
Upvotes: 5
Views: 6320
Reputation: 45589
$link = '[link="http://www.google.com/"]';
$link = preg_replace('/\[link="(.*)"\]/', '<a href="$1">', $link);
Upvotes: 3