Ban
Ban

Reputation: 131

How to get text of URL from notepad plus?

I have this text:

1135/how-are-you-86789/pp
1125/example-fran%C3%A7aise-86749/pp
1125/episode-6-movie-86749/pp

Can you give me the regex which can get text "something", please ?. So, the ouput will be:

how-are-you
example-fran%C3%A7aise
episode-6-movie

Upvotes: 0

Views: 292

Answers (1)

nu11p01n73R
nu11p01n73R

Reputation: 26667

How about something like

/[a-zA-Z]+(?:-[a-zA-Z]+)+/g

Regex Demo

EDIT 1

To replace the contents, a small change in regex would help

^(?:[^\/]+\/)?([a-zA-Z]+(?:-[a-zA-Z]+)+).*$/gm

Replaced with \1, capture group content

Regex Demo


EDIT 2

^[^\/]+\/([^-\/\n]+(?:-[^-\/\n]+(?=-))+).*$

replace with \1

Regex Demo

Upvotes: 1

Related Questions