Reputation: 131
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
Reputation: 26667
How about something like
/[a-zA-Z]+(?:-[a-zA-Z]+)+/g
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
EDIT 2
^[^\/]+\/([^-\/\n]+(?:-[^-\/\n]+(?=-))+).*$
replace with \1
Upvotes: 1