Limit concurrent connections based on part of URI

Hi,

Cannot find a good example after a fair amount of googling.

Want to concurrent connection limit based on client part of the URI below.

api.myapp.com/client1/dothis
api.myapp.com/client2/dothis
api.myapp.com/client3/dothis
api.myapp.com/client4/dothis
api.myapp.com/clientN/dothis

Having a hard time figuring how to parse out /clientX/ in to a var to place in a stick table.

Want to limit any particular client to no more than X connections as a safety valve.

Can someone help?