On 08 August 2003 15:39, Dan Joseph wrote:

> I've searched the high heavens for a method of doing this...
> Here's what
> I'm doing... First, the code..
> 
> $middlenum = preg_replace("/^".$this->start_num."/", "",
> $this->ach_acct_num); $middlenum =
> preg_replace("/".$this->end_num."$/", "", $middlenum); 
> 
> In a nutshell, what I want to do is chop off the front and the back.
> Example: 
> 
> I have: 1234567890
> I want: 456
> 
> I have a start num and an end num.  start = 123, end = 7890.
> 
> This is working fine as I have it above, however I'd like to combine
> it into one regular express, instead of two.  Can someone give me an
> example of matching the beginning and end at the same time?

   $middlenum = preg_replace("/^${this->start_num}(.*)${this->end_num}$/", '$1', 
$this->ach_acct_num);

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

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

Reply via email to