On 15 August 2003 12:02, Merlin wrote:

> Hi there,
> 
> I have a regex problem.
> 
> Basicly I do not want to match:
> 
> /dir/test/contact.html
> 
> But I do want to match:
> /test/contact.html
> 
> I tryed this one:
> ^[!dir]/(.*)/contact(.*).html$

Well, that's not going to work because the construct [!dir] means "match any single 
character that is ! or d or i or r.  Even if you use the correct negation character, 
to give [^dir], that's still not going to work as it means match any ONE character 
which is neither d nor i nor r.

I *think* what you want here is what's called a lookahead assertion, but I've never 
tried to use one of those so I'm not even going to attempt a suggestion; however, they 
are documented in the PHP manual at 
http://www.php.net/pcre.pattern.syntax#regexp.reference.assertions, so a good peruse 
through that section may set you on the way.

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