Reputation: 981
I'm trying to get a search pattern done so I get the video URL on certain portals. For one particular site I've been using this:
/www.website.net\/category\/[a-z-]*\/[a-z-]*\/[0-9a-z]*^[^\/]/
on www.website.net/category/topic/more/abcde/
in order to say 'the string matches' only if there isn't a slash after the abcde part. I now managed to do this, but even if the slash at the end is gone it doesn't return any matches. What did I do wrong?
EDIT:
I now settled for
/www.website.net\/category\/[a-z-]*\/[a-z-]*\/[0-9a-z]*[^\/]+$/
in order to only prevent the match if there is a slash, since the video URL at the back also has a string in the format /abcde-here-comes-video-name. Thanks!
Upvotes: 0
Views: 54
Reputation: 2314
Near the end of your regex, you have "^[^/]". The first caret (^) shouldn't be there.
Upvotes: 2
Reputation: 473803
How about checking for the end of the string using $
:
/www.website.net\/category\/[a-z-]*\/[a-z-]*\/[0-9a-z]*$/
Upvotes: 2