I’m using the regex \/s1600-h\/[^\/\s'"]+ to match URLs with the directory of /s1600-h/ in an URL, i.e.
http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RlcBEI/AAAAEU/D630/s1600-h/tedsobject.jpg
and that matches from /s1600-h/ to the right and includes the file and extension.
But how can I expand the match to the left to match the entire URL? No matter the number of subdirectories? And either http or https?
Here’s a fiddle: https://regex101.com/r/agB4iJ/1
>Solution :
If you don’t care about valid URL and just want to match the line containing that path, then simply prepend .+
.+\/s1600-h\/[^\/\s'"]+
