I am looking for a way to capture the following with either a regular expression or a built-in function in Python.
From /url-path/YYYYMMDD-N/url-path-cont I only need YYYYMMDD-N. Sometimes the -N is present and sometimes it is not. I have tried various methods but so far all my attempts either stop at YYYMMDD or capture part of /url-path-cont.
I would like to capture only the YYYYMMDD-N with the -N as optional whenever present.