views:

311

answers:

1

I have an SQL document formatted as so (It has about 3000 entries like so):

INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) VALUES('99b857afcb2e4f7dbf8657ea916ad9d7',FALSE,'SPACE')
INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) VALUES('df8480e333c044f08ada939c66fa13f5',FALSE,'AIR')
INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) VALUES('ad3e38a5e28f40ba8234bb8727936963',FALSE,'SURFACE')
INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) VALUES('58f23ec0b9d141ed89dba8ce2f0fd377',FALSE,'SUBSURFACE')
INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) VALUES('244182c8e53247529bd55f54c527bdbf',FALSE,'LAND')

I need to format all of the UUID Strings to include the dashes like so:

550e8400-e29b-41d4-a716-446655440000

Is there a simple way to parse through this and format the UUIDs the way I need them without doing it by hand?

+3  A: 

Try this regular expression:

'([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})'

and replace the matches by '$1-$2-$3-$4-$5'.

Gumbo