I have been trying to make a Reg Exp to match the URL with specific domain name.
So if i want to check if this url is from example.com what reg exp should be the bes
There are cases where the domain you're looking for could actually be found in the query section but not in the domain section: https://www.google.com/q=www.example.com
https://www.google.com/q=www.example.com
This answer would treat that case better. See this example on regex101.