Re: [PHP] REGEX query

2006-02-09 Thread Tom Rogers
Hi, Saturday, February 4, 2006, 2:53:32 PM, you wrote: p> Hi, p> I'm still trying to get to grips with REGEX and have hit a hurdle with p> the following: p> I have this bit of text: p> (\(EX\) RV-6 ) p> I want to remove the '\(EX\)' part of it p> so leaving just: ( RV-6 ) p> Any suggestions wo

Re: [PHP] REGEX query

2006-02-08 Thread phplists
>>> > I have this bit of text: >>> > (\(EX\) RV-6 ) >>> > >>> > I want to remove the '\(EX\)' part of it >>> > so leaving just: ( RV-6 ) $text = '(\(EX\) RV-6 )'; $str = str_replace('\(EX\)','',$text); As Burhan put it, regex is not always the solution to your problem - in most cases, using re

Re: [PHP] REGEX query

2006-02-08 Thread Kim Christensen
Alexis, > Unfortunately, for what I'm trying to do, it is of little use. I > probably should have mentioned that the bit of text I used is actually > just part of a much bigger bit of text so exploding on a space would > cause havoc with the rest of it. Hence the REGEX question. $text = '

Re: [PHP] REGEX query

2006-02-08 Thread phplists
Hi Murray, The length of text is quite long..it is in fact a 150+ page PDF file, which as it's using an earlier version of PDF I can 'translate' into a format that I can extract data from..it's just this one bit of text that I'm stuck on. Yes it does appear multiple times, but the pattern is

Re: [PHP] REGEX query

2006-02-08 Thread phplists
Thanks for that...and yes that would do very nicely. Unfortunately, for what I'm trying to do, it is of little use. I probably should have mentioned that the bit of text I used is actually just part of a much bigger bit of text so exploding on a space would cause havoc with the rest of it. Hen

Re: [PHP] REGEX query

2006-02-08 Thread Kim Christensen
> > I have this bit of text: > > (\(EX\) RV-6 ) > > > > I want to remove the '\(EX\)' part of it > > so leaving just: ( RV-6 ) $text = '(\(EX\) RV-6 )'; $str = str_replace('\(EX\)','',$text); As Burhan put it, regex is not always the solution to your problem - in most cases, using regex for this

Re: [PHP] REGEX query

2006-02-08 Thread Burhan
phplists wrote: Hi, I'm still trying to get to grips with REGEX and have hit a hurdle with the following: I have this bit of text: (\(EX\) RV-6 ) I want to remove the '\(EX\)' part of it so leaving just: ( RV-6 ) $text = '(\(EX\) RV-6 )'; $bits = explode(' ',$text); $leaving = '( '.$bits[0

Re: [PHP] REGEX query

2006-02-04 Thread phplists
Thanks for the options David. I think I'll go for the last option as I'm determined to get to grips with REGEX, and your first choice of REGEX won't work for me as the 'RV-6' bit can be too variable with what it contains, whereas the \(EX\) bit IS more constant...it's only the EX bit that chan

Re: [PHP] REGEX query

2006-02-03 Thread David Tulloh
I assume that the text inside can change around a fair bit. If the string is of a fixed with or simple format you can just use substr() and friends, it's simpler and faster. That said, there is really two approaches that I can see with this string. You can match on the spaces to extract the 'RV-

[PHP] REGEX query

2006-02-03 Thread phplists
Hi, I'm still trying to get to grips with REGEX and have hit a hurdle with the following: I have this bit of text: (\(EX\) RV-6 ) I want to remove the '\(EX\)' part of it so leaving just: ( RV-6 ) Any suggestions would be most appreciated. Thanks Alexis -- PHP General Mailing List (http://