4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

HIVE username Regex | Round 2

hive_username_regex_checker_round_2.jpg


Yesterday I made a post about a HIVE username Regex & an open-source tester against the 2,409,078 existing usernames of the HIVE Blockchain I made.

On the 2,409,078 usernames it failed 11 due to "--"

I was sure the rules of a correct username on the HIVE Blockchain were:

. is the segment separator
Each segment must be at least 3 characters long
Each segment must begin with a letter (a-z) and end with a letter or a number (0-9)
All letters contained in a segment must be lowercase
Hyphens (-) must be accompanied side by side by letters or numbers

But it looks like I was wrong! The last rule doesn't exist in the core of HIVE as you can see below (Thanks to @mahdiyari for providing it)

https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/protocol/authority.cpp#L46

Even Steemit, who created the code base, doesn't respect it on their frontend and shows you this error "Account name should contain only one dash in a row"

So this morning I reviewed my Regex and regretfully removed the last rule that gave it its beauty as a beautiful mathematical equation. You can see the new Regex below

^(?=.{3,16}$)[a-z][0-9a-z\-]{1,}[0-9a-z]([\.][a-z][0-9a-z\-]{1,}[0-9a-z]){0,}$

It passed the test with success the 2,409,204 existing usernames of the HIVE Blockchain (Yep, today there are more Hivians than yesterday!)

![screenshot_2022_06_30_113841.jpg](https://images.ecency.com/DQmYmCxNv4WRoDSkh5GXGNFeCjkkkmoCSzbQ9PAk42dS7QK/screenshot_2022_06_30_113841.jpg)
![screenshot_2022_06_30_121401.jpg](https://images.ecency.com/DQmSaTGq7KsG3db55ZgYzaEoFyuAg5e8rvgRd2nS7WPFYer/screenshot_2022_06_30_121401.jpg)

I also made some tests of the auto-generated file

![screenshot_2022_06_30_121653.jpg](https://images.ecency.com/DQmZs37N7Mnf5nXck7vNN1qm8QsmwUBWtMWaL3DJuReZewx/screenshot_2022_06_30_121653.jpg)
![screenshot_2022_06_30_122155.jpg](https://images.ecency.com/DQmcsKoyDpDdjFzkv4oMZUmtkxyLSnsEjyAKqVGRBb7SfHF/screenshot_2022_06_30_122155.jpg)

I invite @peakd @ecency @hiveonboard @inji and all those who have a signup process (frontend or library) with this rule to review their code ;)

![sep.png](https://images.ecency.com/DQmNcUswn2WAmunoBCWCH3zetpb4LoMF8PBoshXTDUv6GJz/sep.png)
@mintrawa :)

Thanks for your support and trust as a
**HIVE block producer** (witness active rank 72)
[My HIVE block producer (witness) introduction post](/@mintrawa/introducing-a-gen-x-geek-gamer-traveler-witness)
![sep.png](https://images.ecency.com/DQmNcUswn2WAmunoBCWCH3zetpb4LoMF8PBoshXTDUv6GJz/sep.png)
ukr ukr
NFT for Peace
NFT for Peace
Vote for my HIVE block producer account (witness): [click here (via **HiveSigner**)](https://hivesigner.com/sign/account-witness-vote?witness=mintrawa&approve=1)

*Original Cover Photo of this post by [Daniele Levis Pelusi](https://unsplash.com/@yogidan2012?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/gearing?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)*
46 upvotes $1.58

Replies (2)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: