title: Regex - match everything but forward slash
body: <p>in the following string: </p>
  
  <p>/seattle/restaurant</p>
  
  <p>I would like to match Seattle (if it is present) (sometimes the url might be /seattle/restaurant and sometimes it might be /restaurant). What I don't want is to match the following forward slash: seattle/</p>
  
  <p>I have tried the following, but I cannot get it to work:</p>
  
  <pre><code>       /(.*[^/]?)restaurant(\?.*)?$
  </code></pre>
  
  <p>I need the first forward slash, so the solution is not to remove that, which I can do like this: </p>
  
  <pre><code>     (/?)(.*)/restaurant(\?.*)?$   
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Thomas</p>