RE: [PHP] Regular Expression Question correction
| From: | Seb Frost | Date: | Wed, 25 Jul 2001 21:04:04 +0000 |
| Subject: | RE: [PHP] Regular Expression Question correction | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59618@lists.php.net to get a copy of this message | ||
$newstring = substr($string,1,4);
FOUR, not FIVE. Doh.
-----Original Message-----
From: Seb Frost [mailto:seb@raceshoot.com]
Sent: 25 July 2001 22:03
To: jeff@webdesigns1.com; PHP
Subject: RE: [PHP] Regular Expression Question
since you know exactly which 4 characters you want to keep you can use a
simple string trimming routine.
$newstring = substr($string,1,5);
No need for complicated regular expressions!
- seb
-----Original Message-----
From: Jeff Oien [mailto:jeff@webdesigns1.com]
Sent: 25 July 2001 21:47
To: PHP
Subject: [PHP] Regular Expression Question
I want to replace a string like this 1B335-2G with this B335. So for all the
strings I want to remove the first character and the last three characters.
I'm not sure which replace function to use or how to go about it. Thanks.
Jeff Oien
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net