python – regex to extract non constant characters from a string

How to extract non constant characters from a string using regex. String is

archives/latest/pipelines/my-page/pages/content/page1/,

here i have to removearchives/latest/pipelines‘ and ‘pages/‘, which repeats in multiple strings

i have extracted my-page using below regex

(?<=archives\/latest\/pipelines\/)[^\/]*(?=\/pages\/)

but not sure how to extract /my-page/content/page1/

i/p : archives/latest/pipelines/my-page/pages/content/page1/
o/p : /my-page/content/page1/

please help

Read more here: Source link