RegEx to exclude a string

Posted by sameera207 on Stack Overflow See other posts from Stack Overflow or by sameera207
Published on 2011-01-09T14:45:45Z Indexed on 2011/01/09 14:53 UTC
Read the original article Hit count: 374

Filed under:

Hi All,

I have the following strings in my application.

/admin/stylesheets/11

/admin/javascripts/11

/contactus

what I want to do is to write a regular expression to capture anything other than string starting with 'admin'

basically my regex should capture only

/contactus

by excluding both

/admin/stylesheets/11

/admin/javascripts/11

to capture all i wrote

/.+/

and i wrote /(admin).+/ which captures everything starts with 'admin'. how can i do the reverse. I mean get everything not starting with 'admin'

thanks in advance

cheers

sameera

© Stack Overflow or respective owner

Related posts about regex