1

Here is my regex i want to exclude string login_overlay but i am unable to exclude that string from my regex it capture the login string and passes the regex:

(^\/$|!login_overlay|login|welcome|register|password_forgot|terms|privacy|company_site|account_calendar|account_cancel|account_facebook|account_google|account_ical|account_language|account_outlook|account_password)

What am i doing wrong is there something wrong with my regex condition?

2 Answers 2

3

You need to use negative lookahead for that:

(?!.*?login_overlay)

See Lookaround Tutorial

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks mate it helped me i will mark it correct when it will allow me
thanks again for the tutorial edit once again sir :)
Just did i was waiting for time limit to end
2

You can't exclude strings from regexes that easily. Although if your regex implementation supports negative lookahead, you can get close:

  (^\/$|(?!login_overlay|something_else_excluded|...)(login|welcome|...))

1 Comment

Thanks mate for the concept it was really helping it means i can use negative look ahead to achieve my goal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.