Re: [nyphp-talk] Question about REGEX's...

2006-11-28 Thread Greg Rundlett
One nice 'trick' in using regex to match code is to use another delimiter character bessides '/' since it is so commonly found in the 'needle' pattern. Other 'common' delimiters are % or #. e.g. instead of preg_match('/needle/imUs', $haystack); do this preg_match('#needle#imUs', $haystack); Usi

Re: [nyphp-talk] Question about REGEX's...

2006-11-28 Thread Anirudh Zala
You are violating 2 rules here of how to use regular expressions. #1 Regular expressions always needs 2 arguments. 1: Pattern to be matched and 2: String in which defined pattern is to be matched. Here you missed 2nd arguments that is why parser gives ) => / error. #2 Quote (double or single) i

Re: [nyphp-talk] Question about REGEX's...

2006-11-28 Thread Mark Armendariz
Is it returning everything between that first div and the last on the page? If so, it's being 'greedy'. Basically that .+? is matching everything (including interior 's). You can use the 'Ungreedy' modifier 'U' (captial u after the final slash) or make your regex between the divs more specific

Re: [nyphp-talk] Question about REGEX's...

2006-11-28 Thread Chris Merlo
On 11/28/06, Anthony Papillion <[EMAIL PROTECTED]> wrote: Hello Everyone, I am using the following regex to retrieve text between two tags. $trans_text = preg_match(/(.+?)/); Don't you need to surround the pattern in quotes? I always have. -c _

Re: [nyphp-talk] Question about REGEX's...

2006-11-28 Thread Anthony Papillion
esday, November 28, 2006 6:56 PM Subject: Re: [nyphp-talk] Question about REGEX's... Anthony Papillion wrote: > Hello Everyone, > > I am using the following regex to retrieve text between two tags. > > $trans_text = preg_match(/(.+?)/); > > However, the parser keeps tell

Re: [nyphp-talk] Question about REGEX's...

2006-11-28 Thread Paul Houle
Anthony Papillion wrote: Hello Everyone, I am using the following regex to retrieve text between two tags. $trans_text = preg_match(/(.+?)/); However, the parser keeps telling me it expects a ) but found / instead. What am I doing wrong? It's probably the / in /div. Try ...<\/div>/

[nyphp-talk] Question about REGEX's...

2006-11-28 Thread Anthony Papillion
Hello Everyone, I am using the following regex to retrieve text between two tags. $trans_text = preg_match(/(.+?)/); However, the parser keeps telling me it expects a ) but found / instead. What am I doing wrong? Can anyone please help a regex newbie in his quest? lol Thanks, Anthony__