You are viewing a single comment's thread from:
RE: The 5 Rules of a Valid Username on the Steem Blockchain (and a 3 SBD contest to make an account name validation RegEx)
You can include the split in the regex like this:
/^regex(?:\.regex)*$/
You can include the split in the regex like this:
/^regex(?:\.regex)*$/
Sure. But here's a solution in Perl with very few headaches. I can also write it in C++, C, Python or Javascript rather painlessly. I can write it in any other language you prefer with a little bit of reference work.
@split = split(/\./, $username);
$l = length($username);
if ($l > 16) { return 0; }
else {
foreach $seg (@split) {
if (($seg =~ /-/) && ($seg !~ /\b\-*\b/)) {
return 0;
}
elsif ($seg !~ /^[a-z0-9][a-z0-9\-]+[a-z0-9]+$/) {
return 0;
}
else {
return 1;
}
}
}