Re: [PHP] trying to match the front and end...

2003-08-14 Thread John W. Holmes
Dan Joseph wrote: Question: Where is this number coming from? Couldn't you just use a substr() based upon it's length and not deal with a regular expression? Its a bank account number coming from a database. We're reformatting it for ACH processing. The number could be: 23408234980423

Re: [PHP] trying to match the front and end...

2003-08-14 Thread CPT John W. Holmes
From: Dan Joseph [EMAIL PROTECTED] 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,

RE: [PHP] trying to match the front and end...

2003-08-14 Thread Dan Joseph
Hi, Not tested, mind you. I know what you're saying, too. How is _all_ of that code better(worse?) than one simple regex? Benchmark it and see. You'll be surprised how a lot more code with simple string functions will be considerably faster than a complex regular expression. Your results may

RE: [PHP] trying to match the front and end...

2003-08-14 Thread Dan Joseph
Hi, 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,

Re: [PHP] trying to match the front and end...

2003-08-14 Thread John W. Holmes
Dan Joseph wrote: From John: $new_number = preg_replace('/^'.$this-start_num.'([0-9]+)'.$this-end_num.'$/', '\\1',$old _number); The one that Mike gave didn't seem to do anything, John's will work if it can match the beginning and the end successfully. I should probably explain myself

Re: [PHP] trying to match the front and end...

2003-08-14 Thread John W. Holmes
Dan Joseph wrote: Sometimes there won't be anything to replace at the front, and sometimes nothing at the end. So it'd still need to do the front and/or end wether or not they both exist. Is there a way to tweak these to do that? Question: Where is this number coming from? Couldn't you

RE: [PHP] trying to match the front and end...

2003-08-10 Thread Ford, Mike [LSS]
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

[PHP] trying to match the front and end...

2003-08-10 Thread Dan Joseph
Hi Everyone, 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

RE: [PHP] trying to match the front and end...

2003-08-09 Thread Dan Joseph
Hi, Question: Where is this number coming from? Couldn't you just use a substr() based upon it's length and not deal with a regular expression? Its a bank account number coming from a database. We're reformatting it for ACH processing. The number could be: 23408234980423

RE: [PHP] trying to match the front and end...

2003-08-08 Thread Ford, Mike [LSS]
On 08 August 2003 17:39, Dan Joseph wrote: Hi, 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,