Page 1 of 1

Matching 'menu_1_29_training' not 'menu_2_8_priv_training'

Posted: Thu Jan 29, 2009 11:56 pm
by Glycerine
I would like a regex that matches

menu_2_8_training

But not

menu_2_8_private_training

I have

Code: Select all

 
(menu_.*?_([^_]*)_training)
for my regex but it doesn't work :banghead:

I would like to literally match 'menu_' then next word after '_' to be anything but not '_'... again with the next word after 2nd '_' to be anything BUT an '_'
- then literally match the 'training'

menu_*_*_training would match but menu_*_*_private_training wouldn't - Any help and I'll buy you a beer - and deliver it... to ANYWHERE. I hope my babbly makes some sense.

Thanks in advance.

Re: Matching 'menu_1_29_training' not 'menu_2_8_priv_training'

Posted: Fri Jan 30, 2009 12:45 am
by prometheuzz

Code: Select all

'/^menu_([^_]+)_([^_]+)_training$/'

Re: Matching 'menu_1_29_training' not 'menu_2_8_priv_training'

Posted: Fri Jan 30, 2009 11:40 am
by Glycerine
Thanks again prometheuzz - once again my saviour -

Re: Matching 'menu_1_29_training' not 'menu_2_8_priv_training'

Posted: Fri Jan 30, 2009 1:42 pm
by prometheuzz
Glycerine wrote:Thanks again prometheuzz - once again my saviour -
Hey Jay, you're welcome of course!

Regards,

Bart.

Re: Matching 'menu_1_29_training' not 'menu_2_8_priv_training'

Posted: Fri Jan 30, 2009 1:45 pm
by prometheuzz
Glycerine wrote:Thanks again prometheuzz - once again my saviour -
... oh, and Duvel is my brew, btw!
; )