0

Ok, so tried messing with some patterns on a couple regex sites. Not sure why I can't get this.

How can I match all url params after account?

/account/home/dashboard/

/account/random/place/place2/place3/

I want to match any param after account ^

limit
  • 647
  • 2
  • 8
  • 27

1 Answers1

0

If you have

path = "/account/home/dashboard/"

then

path.match(/\/account\/(.*)/)

will return

["/account/home/dashboard/", "home/dashboard/"]

So, what I think you want is to just call:

path.match(/\/account\/(.*)/)[1]
BananaNeil
  • 10,322
  • 7
  • 46
  • 66
  • Yeah pretty much trying to match anything after account/ I messed with this account/*\(*(.+) and seems to work, but not sure if it's correct. – limit May 25 '16 at 19:47