Created
September 14, 2021 05:22
-
-
Save ardislu/87a8acebd42b23e34411fad289d83038 to your computer and use it in GitHub Desktop.
Display a UUID as five groups separated by hyphens, in the form 8-4-4-4-12.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const uuid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; | |
uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, '$1-$2-$3-$4-$5'); | |
// 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment