in reply to Regex to match non image urls
In these cases it is generally easier to write a regexp which matches only image URLs, and then use the negative match operator !~ instead of the match operator =~.
if ($url !~ m{^.*(jpe?g|gif|xbm|png|bmp)$}) { say "$url is not an image"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex to match non image urls
by userdefinable (Initiate) on Jan 18, 2013 at 09:23 UTC | |
by tobyink (Canon) on Jan 18, 2013 at 12:36 UTC | |
by muba (Priest) on Jan 18, 2013 at 13:13 UTC |