JoyFreak Well-known member Nov 11, 2020 #1 Does anyone know why the below regex isn't working/saving: Code: ('/^(http|https):\/\/(.*?)\.(imgur)\.(com)\/(.*?)\.(png|jpg|gif|PNG|JPG|GIF)$/i',$url) I'm trying to make it so users are only allowed to link to imgur with JPG, PNG, GIF supported types.
Does anyone know why the below regex isn't working/saving: Code: ('/^(http|https):\/\/(.*?)\.(imgur)\.(com)\/(.*?)\.(png|jpg|gif|PNG|JPG|GIF)$/i',$url) I'm trying to make it so users are only allowed to link to imgur with JPG, PNG, GIF supported types.
arn Well-known member Nov 11, 2020 #2 Try this? regex101: build, test, and debug regex Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust. regex101.com Upvote 1 Downvote
Try this? regex101: build, test, and debug regex Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust. regex101.com
JoyFreak Well-known member Nov 11, 2020 #3 arn said: Try this? regex101: build, test, and debug regex Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust. regex101.com Click to expand... Thank you but this turned out to work for me: Code: (http|https):\/\/(.*?)\.(imgur)\.(com)\/(.*?)\.(png|jpg|gif|PNG|JPG|GIF) Upvote 0 Downvote
arn said: Try this? regex101: build, test, and debug regex Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust. regex101.com Click to expand... Thank you but this turned out to work for me: Code: (http|https):\/\/(.*?)\.(imgur)\.(com)\/(.*?)\.(png|jpg|gif|PNG|JPG|GIF)
arn Well-known member Nov 11, 2020 #4 JoyFreak said: Thank you but this turned out to work for me: Code: (http|https):\/\/(.*?)\.(imgur)\.(com)\/(.*?)\.(png|jpg|gif|PNG|JPG|GIF) Click to expand... you're gonna want "jpeg" in there too: Code: https://i.imgur.com/zeOe49Q.jpeg Upvote 0 Downvote
JoyFreak said: Thank you but this turned out to work for me: Code: (http|https):\/\/(.*?)\.(imgur)\.(com)\/(.*?)\.(png|jpg|gif|PNG|JPG|GIF) Click to expand... you're gonna want "jpeg" in there too: Code: https://i.imgur.com/zeOe49Q.jpeg
JoyFreak Well-known member Nov 11, 2020 #5 arn said: you're gonna want "jpeg" in there too: Code: https://i.imgur.com/zeOe49Q.jpeg Click to expand... Thank you for spotting that! Upvote 0 Downvote
arn said: you're gonna want "jpeg" in there too: Code: https://i.imgur.com/zeOe49Q.jpeg Click to expand... Thank you for spotting that!