Mijn regular expression-kennis is wat roestig, maar ik geloof dat dit wel zou moeten werken:
PHP:
1
2
3
| function AHREF2text($string) {
return preg_replace("#<a [^<>]*href=["\']?([^ "\']*)["|\']?[^<>]*>([^<]*)</a>#i" ,'[\\3] (link: \\2)', $string);
} |
'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.