Some users using URLs (Domains) in there usernames. They are sometimes much different, so i want to filter them out in there name
I can str.replace urls, if i know the urls, but there much different so i think regex is, how it works, but i try so much, but doesnt get any results...
I hope someone can help me.
I found that Regex for PHP but i need something for NodeJS / Javascript.
$regex = '/^(.*?)';
$regex .= "((https?|ftp)\:\/\/)?"; // SCHEME
$regex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?"; // User and Pass
$regex .= "([a-z0-9-.]*)\.([a-z]{2,3})"; // Host or IP
$regex .= "(\:[0-9]{2,5})?"; // Port
$regex .= "(\/([a-z0-9+\$_-]\.?)+)*\/?"; // Path
$regex .= "(\?[a-z+&\$_.-][a-z0-9;:@&%=+\/\$_.-]*)?"; // GET Query
$regex .= "(#[a-z_.-][a-z0-9+\$_.-]*)?"; // Anchor
$regex .= '(.*?)$/i';
A username looks like
USERNAME Google.com
but can also
USERNAME www.GOOGLE.com
or
USERNAME GOOGLE.GG
.in username. Even with regex users could do something likegoogle(.)com, google . cometc.USERNAME GOOGLEcomNot really better :/.in their username when registering. It's just a suggestion, not the only solution. You could create a massive regex to check different combinations.