Re: [PHP] substr() on part an ereg() capture

2003-03-26 Thread Justin French
A that makes more sense!!  Am trying everyone's suggestions now...

Justin French


on 27/03/03 3:32 AM, Marek Kilimajer ([EMAIL PROTECTED]) wrote:

> Forgot to mention this is to be run after
> eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", " href=\"\\1://\\2\\3\" {$t}\">\\1://\\2\\3", $str);
> as it only replaces long strings within  tags
> 
> 
> Marek Kilimajer wrote:
> 
>> $str = preg_replace('|(]*>[^<]{55})[^<]+()|','$1...$2', $str);
>> 
>> Justin French wrote:
>> 
>>> Hi, I have this ereg to turn URLs into links:
>>> 
>>> eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", ">> href=\"\\1://\\2\\3\" {$t}\">\\1://\\2\\3", $str);
>>> 
>>> ... found it in the manual i think, or maybe on weberdev.com examples
>>> 
>>> 
>>> Anyhoo, it places the whole link in between the  and ,
>>> 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



Re: [PHP] substr() on part an ereg() capture

2003-03-26 Thread Marek Kilimajer
Forgot to mention this is to be run after
eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $str);
as it only replaces long strings within  tags
Marek Kilimajer wrote:

$str = preg_replace('|(]*>[^<]{55})[^<]+()|','$1...$2', $str);

Justin French wrote:

Hi, I have this ereg to turn URLs into links:

eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $str);
... found it in the manual i think, or maybe on weberdev.com examples

Anyhoo, it places the whole link in between the  and , 
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


Re: [PHP] substr() on part an ereg() capture

2003-03-25 Thread Marek Kilimajer
$str = preg_replace('|(]*>[^<]{55})[^<]+()|','$1...$2', $str);

Justin French wrote:

Hi, I have this ereg to turn URLs into links:

eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $str);
... found it in the manual i think, or maybe on weberdev.com examples

Anyhoo, it places the whole link in between the  and , 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


RE: [PHP] substr() on part an ereg() capture

2003-03-25 Thread Boaz Yahav
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:[EMAIL PROTECTED] 
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:]#?/&=])", "\\1://\\2\\3", $str);

... found it in the manual i think, or maybe on weberdev.com examples


Anyhoo, it places the whole link in between the  and , 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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] substr() on part an ereg() capture

2003-03-25 Thread skate
couldn't you just do substr( $blah, 0, 55)

or something similar?

(i'm crap with syntax, so that's just off my head...)


-skate-
fatcuban.com


- Original Message -
From: "Justin French" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 1:24 PM
Subject: [PHP] substr() on part an ereg() capture


> Hi, I have this ereg to turn URLs into links:
>
> eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", " href=\"\\1://\\2\\3\" {$t}\">\\1://\\2\\3", $str);
>
> ... found it in the manual i think, or maybe on weberdev.com examples
>
>
> Anyhoo, it places the whole link in between the  and , 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
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] substr() on part an ereg() capture

2003-03-25 Thread Justin French
Hi, I have this ereg to turn URLs into links:

eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $str);

... found it in the manual i think, or maybe on weberdev.com examples


Anyhoo, it places the whole link in between the  and , 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