I am using the following Regex:
/\b\Qhttp://\E[^\.\s]+\.[^\s]+\.(?:png|jpe?g|bmp|gif)\b/Si
When evaluating, it will succeed for URL's like
http://someimagehost.com/picture.jpg, but it will not work for URL's like
https://someimagehost.com/picture.jpgI need to make it support both http and https. I thought that changing it to this would work:
/\b\Qhttps?://\E[^\.\s]+\.[^\s]+\.(?:png|jpe?g|bmp|gif)\b/Si
But it doesn't match either the first URL shown above, or the second one. It breaks the Regular Expression somehow.
Can somebody help me with getting a Regex that will support both URL's (with http and https). Code snippet I'm using is as follows:
on *:text:*http*:#:{
var %i = 1
while ($gettok($1-,%i,32) != $null) {
if (http isin $gettok($1-,%i,32)) { var %pvurl $gettok($1-,%i,32) }
inc %i
}
var %regex /\b\Qhttp://\E[^\.\s]+\.[^\s]+\.(?:png|jpe?g|bmp|gif)\b/Si
if (!$regex(%pvurl,%regex)) {
; Unsupported URL - Do Sad things
}
else {
; Supported URL - Do happy things
}
}
Thanks in advance!