[PHP] RE: [PHP-WIN] i need help

2004-05-18 Thread Gryffyn, Trevor
If the format is consistantly the same, try this:

$somedata = [i:aslkdfj];
$insidedata = substr($somedata,3,strlen($somedata)-4);

-TG

 -Original Message-
 From: Student [mailto:[EMAIL PROTECTED] 
 Sent: Monday, May 17, 2004 11:42 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP-WIN] i need help
 
 
 Hi i was hoping if someone can help;
 
 I want to trim the following text
 
 [i:abcdef]
 
 but the inside text is different at time eg abcdef, bcdefg, etc etc
 how can i trim [i:(some text here)] so that i can replace 
 them with nothing.
 
 eg these are to be trimmed.
 
 [i:abcdef]
 [i:bcdefg]
 [i:xyzab]
 [i:priftds]
 
 how can i trim them..
 thanks
 
 -- 
 
 

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



[PHP] Re: [PHP-WIN] i need help

2004-05-18 Thread Cory D. Wiles
Assuming you are doing just one string at a time:
?
$str = [i:abcdef];
#[i:bcdefg]
#[i:xyzab]
#[i:priftds]
$regex = /(\[i:)(\w+)(\])/i;
preg_match($regex, $str, $matches);
print $str;//original string
print substr($matches[2], 1, 3);//trimmed string
?
Gryffyn, Trevor wrote:
If the format is consistantly the same, try this:
$somedata = [i:aslkdfj];
$insidedata = substr($somedata,3,strlen($somedata)-4);
-TG

-Original Message-
From: Student [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 11:42 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-WIN] i need help

Hi i was hoping if someone can help;
I want to trim the following text
[i:abcdef]
but the inside text is different at time eg abcdef, bcdefg, etc etc
how can i trim [i:(some text here)] so that i can replace 
them with nothing.

eg these are to be trimmed.
[i:abcdef]
[i:bcdefg]
[i:xyzab]
[i:priftds]
how can i trim them..
thanks
--


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