0

I am trying to write a regular expression in which I want to compare the URL's.

Any URL Matches http://*.xyz.com Except or Excluding http://m.xyz.com and http://m.product.xyz.com

So far I was trying to do it by using if else in RegExp but I couldn't be able to do it right...

(^http:\/\/)(((1)<!(m|m\.product))\.xyz\.co\.jp)?
1
  • 3
    Show us what you tried. Commented Jun 8, 2017 at 6:40

2 Answers 2

3

You can try that:

^http:\/\/(?!m\.xyz\.com|m\.product\.xyz\.com).*\.xyz\.com$

Regex101 Demo

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

2 Comments

It worked perfectly. Now i know what was the mistakes i was doing. Thanks very much
@ShanArshad Could you accept the answer if it solved your issue?
2

https?:\/\/(?!m\.|m\.product\.).*\.xyz\..*

This regex accepts all *.xyz.* domains except m.xyz.* and m.product.xyz.*. Also takes care of http or https.

Demo

Comments

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.