RE: [PHP] substr() on part an ereg() capture
| From: | Boaz Yahav | Date: | Tue, 25 Mar 2003 18:20:43 +0000 |
| Subject: | RE: [PHP] substr() on part an ereg() capture | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-140982@lists.php.net to get a copy of this message | ||
Looks like this one :
http://examples.weberdev.com/get_example.php3?count=1567
so if someone manages to get this done, i would appreciate it if he can
add a comment.
thanks
berber
-----Original Message-----
From: Justin French [mailto:justin@indent.com.au]
Sent: Tuesday, March 25, 2003 3:24 PM
To: php
Subject: [PHP] substr() on part an ereg() capture
Hi, I have this ereg to turn URLs into links:
eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "<a
href=\"\\1://\\2\\3\" {$t}\">\\1://\\2\\3</a>", $str);
... found it in the manual i think, or maybe on weberdev.com examples
Anyhoo, it places the whole link in between the <a...> and </a>, which
is fine for short links, but on longer links (in my case, around 60+
chars), it messes with my table or CSS layout.
So, I'd like to subtr() the 2nd capture part down to 55 chars or
something IF it's longer than 60, and append a ... to it.
ANY ideas on how this is done? Or is this beyond regexp??
TIA
Justin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php