title: JAX-RS @Path() custom format
body: <p>I'm Regex newbie. What I trying to do here is, I have <strong>2 @PathParam</strong> so the user can either type in <strong>"/session"</strong> or <strong>"/requester"</strong> or <strong>anything</strong> but these two.</p>
  
  <p>If the user type "/session" or "/requester" this input will go to <strong>pathparam 1</strong> else the <strong>pathparam 2</strong>.</p>
  
  <p>Here is my regex.</p>
  
  <pre><code>@Path("/generateotp{session:(/session[^\\w&amp;&amp;[^\\W]]|/requester[^\\w&amp;&amp;
  [^\\W]])?}{senderid:(/[^/&amp;&amp;\\w]|(?:(?!requester|session).))?}")
  </code></pre>
  
  <p>I know I'm kind of redundant the <strong>[^\w&amp;&amp;[^\W]]</strong> part but the <strong>[^.+]</strong> just don works.</p>
  
  <p>Extra things here. How can I cut the "/" when the input will go to the senderid pathparam. I need the user to input it in because of the <em>generateotp</em> there but when it process and throw to the pathparam, that is where i don't need it. I can use substring after that to cut it but is there anyway i can do it in the regex?</p>