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
I think this is what you're looking for: (https?:\/\/(.+?\.)?example\.com(\/[A-Za-z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;\=]*)?).
It breaks down as follows:
https?:\/\/ to match http:// or https:// (you didn't mention https, but it seemed like a good idea).(.+?\.)? to match anything before the first dot (I made it optional so that, for example, http://example.com/ would be foundexample\.com (example.com, of course);(\/[A-Za-z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;\=]*)?): a slash followed by every acceptable character in a URL; I made this optional so that http://example.com (without the final slash) would be found.Example: https://regex101.com/r/kT8lP2/1