[FX.php List] [OT] Did any of you make a function for parsing links from text fields?

Leo R. Lundgren leo at finalresort.org
Fri Jan 30 05:53:41 MST 2009

Here's one code snippet, as simple as it can be. If you want more  
features it needs to be modified (for example allow empty urls/texts,  
or validate/restrict invalid syntax).

$a = '[url=www.google.com]Search[/url]';
$b = preg_replace('/\[url=([^\]]+)\]([^\[]+)\[\/url\]/', '<a  
href="$1">$2</a>', $a);

Is that syntax from FileMaker? It looks like BBcode as well. If  
FileMaker uses the same syntax maybe you can use parts of a BBcode  
library. Just a thought.

30 jan 2009 kl. 13.45 skrev Gjermund Gusland Thorsen:

> [url=www.google.com]Search[/url] or similar?
> Should of course translate to something like <a
> href="http://www.google.com">Search</a>
> ggt667
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list


More information about the FX.php_List mailing list