regex - Regular expression to match string from url -


i want match shop name url .please see example below. url redirection in word press application.

see examples given below

http://example.com/outlets/19-awok?page=2 http://example.com/outlets/19-awok http://example.com/outlets/159-awok?page=3 

in cases need awok url .it text coming after '-' , before query string .

i tried below , not working

/outlets/(\d+)-(.*)? => /shop/$2 

any appreciated.

you can use regex:

/outlets/\d+-([^?]+)? 

trailing ? used strip previous query string.


Comments