0

I have these URL:

http://web.com/George-Eliot/5234-20412_4-54534.html
http://web.com/Reading-HD/3434-20412_4-43454.html

How to extract middle part: George-Eliot and Reading-HD ? I mean removing all except middle part.

2 Answers 2

3

You could use capturing groups.

Use this regex ^http:\/\/[^\/]*\/([^\/]*).* and then replace the matched characters by \1

DEMO

Sign up to request clarification or add additional context in comments.

Comments

0
^.*\/(?=[^\/]*\/[^\/]*$)|\/[^\/]*$

Try this.Replace by empty string.See demo.

https://regex101.com/r/dL7oF8/4

1 Comment

@user3373322 you can try this as well.It will not need any replacement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.