JSFiddle - React, Tailwind, and code Playground

Created for answer to https://stackoverflow.com/questions/25131143/javascript-string-to-guid

by UselessCode

HTML

<div id="out"></div>

JavaScript

var shift = {
    employee: {
        id: '798205486e954fa880a0b366e6725f71'
    }
};

var rxGetGuidGroups = /(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/,
    employeeId = shift.employee.id.replace(rxGetGuidGroups, '$1-$2-$3-$4-$5');

document.getElementById('out').innerHTML = employeeId;