A
A
alexok2014-08-31 07:15:24
Regular Expressions
alexok, 2014-08-31 07:15:24

How to pull out strings with RegExp?

There are 2 url options and something stubbornly fails to pull out woman/dress and 2 correctly
1. catalog/ woman/dress
2. catalog/ woman/dress /Product_page/ 2
3. catalog/ woman/dress/sub-1
4. catalog / woman/dress/sub-1 /Product_page/ 2
this does not work for the 1st line

^catalog\/(?P<path>(?:\w|\d|\/|\-)+)(?:\/\w+_page\/(?P<page>\d+))

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question