aiwazz
asked on
Adding a word to url regex string for a match
Yes, another regex noob asking for regex help... ;) Can the regex in the code block below be modified so that it only allows matches that contain the word gallery in the url before the filename/extension? The url will always look like http://www.***.***/***/gallery/*/filename.*. The wildcard after the gallery directory is a folder numbering system.
Possible? Thanks!
Possible? Thanks!
$pattern = '/\b(http:\/\/[-A-Z0-9+ \t\(\)&@#\/%?=~_|!:,.;]*[-A-Z0-9+ \t\(\)&@#\/%=~_|]\.(?:jpg|jpeg|png|gif|bmp))/si';
preg_match_all($pattern, $row['body'], $matches);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.