Skip to content

Instantly share code, notes, and snippets.

@ghostwriter
Last active July 1, 2022 07:28
Show Gist options
  • Save ghostwriter/bcaba56977f20b14dc5b to your computer and use it in GitHub Desktop.
Save ghostwriter/bcaba56977f20b14dc5b to your computer and use it in GitHub Desktop.
BattleTale Bug #29 (reproducible bug)
/*
1. post a link in chat. (ex. https://github.com/)
2. post anything with 3 or more "w"s in a row. (ex. www, wowww,wwwwwwwwww)
3. use {/geturl} and you'll get the word with the 3 "w" in it and not the url.
Fix: Validate url.
*/
var url:String = "http://www.google.com";
var regex:RegExp = /^http(s)?:\/\/((\d+\.\d+\.\d+\.\d+)|(([\w-]+\.)+([a-z,A-Z][\w-]*)))(:[1-9][0-9]*)?(\/([\w-.\/:%+@&=]+[\w- .\/?:%+@&=]*)?)?(#(.*))?$/i;
trace(regex.test(url)); // returns true if valid url is found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment