 <p>This regex matches valid URLs according to your rules:</p> <pre><code>http((\:\/\/greenbook\.americansalon\.com\/(((leaf|cat)\/(Haircolor|Cosmetics|Shampoos))|company\b).*)|(s?\:\/\/(?!greenbook\.americansalon\.com).*)) </code></pre> <p><a href="https://regex101.com/r/mE0gG2/1" rel="nofollow"><strong>Online demo</strong></a></p>