unexpected result from regular expression of url <p>I am trying to match one part in a url. This url has already been processed and consists of domain name only.</p> <p>For example:</p> <p>The url I have now is business.time.com Now I want to get rid of the top level domain(.com). The result I want is business.time</p> <p>I am using the following code:</p> <pre><code>gawk'{ match($1, /[a-zA-Z0-9\-\.]+[^(.com|.org|.edu|.gov|.mil)]/, where) print where[0] print where[1] }' test </code></pre> <p>In test, there are four lines:</p> <pre><code>business.time.com mybest.try.com this.is.a.example.org this.is.another.example.edu </code></pre> <p>I was expecting this :</p> <pre><code>business.time mybest.try this.is.a.example this.is.another.example </code></pre> <p>However, the output is</p> <pre><code>business.t mybest.try this.is.a.examp this.is.another.examp </code></pre> <p>Can anyone tell me what's wrong and what should I do?</p> <p>Thanks</p>