Vipul
Vipul

Reputation: 610

Match part of a url using regular expression only

Match below url to a regular expression:

https://api.com.org.net/abc/def/some_number/?key=value&key=value

match url with /abc/def in the url. Below is the regular expression I've tried and not working.

https:\/\/(<api\.com\.org\.net\/abc\/def>*)

Upvotes: 0

Views: 56

Answers (1)

Ilya Lysenko
Ilya Lysenko

Reputation: 1892

Try this expression:

(?:[\w:.\/]+)\/abc\/def

See the demo here: https://regexr.com/50sva

Upvotes: 1

Related Questions