Get the path variable from the URL using RegEx

How to get the customerid path variable from the following URL:

/ customers / {customerid} / agreements / {agreementid}

The customerid path variable can vary in length, so I want everything between / clients / and / chords …