0

Title might be confusing but essentially what I'm trying to do is explained below.

If I had a url /app/{var1}/foo for a given class controller

And now at this point I'd like to be able to have a single method that matches:

/bar/bar1/bar2 (where bar1 and bar2 are both optional i.e. it could be bar, bar/bar1 or bar/bar1/bar2)

I do also want a second method that could handle

/bar/X, /bar/bar1/X, bar/bar1/bar2/X (all to be captured and handled by the same method).

Any ideas how the regex here would go. I have the documentation for how to capture the rest of the URL i.e foo/**. But in my case I guess i'm looking to capture cases where the url may also end in a specific way without certainty of the depth.

user1111871
  • 137
  • 1
  • 12
  • you cannot map `/bar/bar1/bar2` and `/bar/bar1/X` to different methods **unless** there is a restriction on how those url parts are formed. i.e X only consists of numbers. – destan Oct 06 '16 at 20:39
  • Well with the assumption that bar2 can be anything other than the pattern in X - So this part I think I is easy. The question is how we get the hierarchy of the url to point to the same method. i.e. bar/..../X – user1111871 Oct 07 '16 at 17:26

0 Answers0