A regex is not necessary:
"/text/text/text/" stripPrefix "https://stackoverflow.com/" stripSuffix "https://stackoverflow.com/"
or if you know they’re always there:
"/text/text/text/".tail.init
0
solved Remove symbol “/” at start and end of string