You can also check out some regular expressions from other formatters. Here is an example from my EtoWiki snippet I developed when using Etomite months ago (based on roWiki) for doing even more than just converting text links, if you’re interested:
$wikiOutput = preg_replace("/$/Umsi", "$", $wikiOutput);
$wikiOutput = preg_replace('#\[(.+)\|h(ttps?://[0-9a-zA-Z\.\#/~\-_%=\?\&,\+]*)\]#U', '<a href="xx$2">$1</a>', $wikiOutput);
$wikiOutput = preg_replace('#h(ttps?://[0-9a-zA-Z\.\&\#\:/~\-_%=?]*\.(jpg|gif|png))#i', '<img src="xx$1" />', $wikiOutput);
$wikiOutput = preg_replace('#(https?://[0-9a-zA-Z\.\&\#\:/~\-_%=?]*)#i', '<a href="$0">$1</a>', $wikiOutput);
$wikiOutput = preg_replace('#xxttp#', 'http', $wikiOutput);
$wikiOutput = preg_replace("/\[([0-9a-zA-Z\- :\.,\(\)\']+)\]/U", "<a href=\"$wikiDocLink?page=$1\">$1</a>", $wikiOutput);
$wikiOutput = preg_replace('#([0-9a-zA-Z\./~\-_]+@[0-9a-z\./~\-_]+)#i', '<a href="mailto:$0">$0</a>', $wikiOutput);
$wikiOutput = preg_replace('/^\*(.*)\n/Um', "<ul><li>$1</li></ul>", $wikiOutput);
$wikiOutput = preg_replace('/^\#(.*)\n/Um', "<ol><li>$1</li></ol>", $wikiOutput);
$wikiOutput = preg_replace('/(<\/ol><ol>|<\/ul><ul>)/', "", $wikiOutput);
$wikiOutput = preg_replace('/^!!!(.*)(\n)/Um', '<h4>$1</h4>', $wikiOutput);
$wikiOutput = preg_replace('/^!!(.*)(\n)/Um', '<h5>$1</h5>', $wikiOutput);
$wikiOutput = preg_replace('/^!(.*)(\n)/Um', '<h6>$1</h6>', $wikiOutput);
$wikiOutput = preg_replace('/----(\r\n|\r|\n)/m', '<hr />', $wikiOutput);
$wikiOutput = preg_replace('/\n/', '<br />', $wikiOutput);
$wikiOutput = preg_replace('#(</h[123]>)<br />#', "$1", $wikiOutput);
$wikiOutput = preg_replace("/{(.+)}/Ue", "'<code><pre>' . preg_replace('#<br />#', '', '\\1') . '</pre></code>'", $wikiOutput);
$wikiOutput = preg_replace("/'''(.*)'''/Um", '<strong>$1</strong>', $wikiOutput);
$wikiOutput = preg_replace("/''(.*)''/Um", '<em>$1</em>', $wikiOutput);
I’d really like to see a Textile or 37 Signals style formatter integrated fully with MODx as a plugin!