enouwee
Non ex transverso sed deorsum
- Reaction score
- 239
If anyone has the patience to explain me, please . For example, a thing I would like to know would be how to make the url tag. Because, in the url tag you can pass 2 arguments (link and the actual text) and I am confused at it.
Here's the basic matching code, so you can see, what it does:
PHP:
<?php
$string = '[a url="test"]this[B]a test[/a]';
if (preg_match(',\[(a|img)\s+url="([^"]*)"\](.*?)\[/\1\],i', $string, $matches))
{
print_r($matches);
}
?>
There are tons of ways to proceed from here. I'd add PREG_OFFSET_CAPTURE to the flags passed to preg_match() and replace the BBCode, including URL and body after a thorough validation using substr_replace().