title: How to check and extract words from url
body: <p>Documentation for Go's built-in regex pkg is here: <a href="https://golang.org/pkg/regexp/" rel="nofollow noreferrer">https://golang.org/pkg/regexp/</a>
  Regex tester in Go here: <a href="https://regoio.herokuapp.com" rel="nofollow noreferrer">https://regoio.herokuapp.com</a></p>
  <p>I have a list of predefined words:</p>
  <pre><code>christmas, santa, tree  ( -&gt; the order here is important. Check for words from left to right)
  </code></pre>
  <p>I am trying to check for one of the above words in different url strings:</p>
  <pre><code>/api/container/:containerID/santa           ( -&gt; I want back santa)
  /api/tree/:containerID/                     ( -&gt; I want back tree)
  /api/tree/:containerID/christmas            ( -&gt; I want back christmas, not tree)
  </code></pre>
  <p>The regex I have tried is is:</p>
  <pre><code>re := regexp.MustCompile(`^(christmas)|(santa)|(tree)$`)
        fmt.Println(&quot;santa? &quot;, string(re.Find([]byte(`/api/container/:containerID/santa`))))
        // output OK: santa? santa
        fmt.Println(&quot;tree? &quot;, string(re.Find([]byte(`/api/tree/:containerID/`))))  
        // output FAIL/EMPTY: tree? 
        fmt.Println(&quot;christmas? &quot;, string(re.Find([]byte(`/api/tree/:containerID/christmas`))))  
        // output FAIL/EMPTY: christmas? 
  </code></pre>
  <p>Have also tried the following, but that gives back the hole string, and not the words I am looking for:</p>
  <pre><code>re := regexp.MustCompile(`^.*(christmas).*|.*(santa).*|.*(tree).*$`
        fmt.Println(&quot;santa? &quot;, string(re.Find([]byte(`/api/container/:containerID/santa`))))
        // output FAIL/HOLE URL BACK: santa? /api/container/:containerID/santa
        fmt.Println(&quot;tree? &quot;, string(re.Find([]byte(`/api/tree/:containerID/`))))  
        // output FAIL/FAIL/HOLE URL BACK: tree? /api/tree/:containerID/ 
        string(re.Find([]byte(`/api/tree/:containerID/christmas`))))  
        // output FAIL/FAIL/HOLE URL BACK: christmas? /api/tree/:containerID/christmas
  </code></pre>
  <p>I do not know what is wrong with the last expression for the regex &quot;engine&quot; should only remember the things inside the paranthesis.</p>