Skip to main content
Hi,

 

 

I would like to change my string (which represents a uuid without dashes) to a uuid with dashes (8-4-4-4-12)

 

But I don't succeed. I know the regex to find the correct groups and a regex to replace with the dashes (found those in some forum for javascripters)

 

 

But if I use a string replacer and this regex to match my text : (\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})

 

and this regex to replace my text: \\$1-\\$2-\\$3-\\$4-\\$5

 

 

My string isn't replaced but it gets my replacement string

 

 

ex:

 

00000000000000000000000004040154 -> \\$1-\\$2-\\$3-\\$4-\\$5 instead of 00000000-0000-0000-0000-000004040154

 

 

And I don't find any other solutions via some other transformer

 

 

What should I do?

 

Thx
You could use an attribute splitter with format string set as 8s4s4s4s12s

 

Then a list concatenator with - as a seperator character
Why did I make it so hard when it could be this simple :)

 

Thx for the quick reply
If you wanted to use the string replacer, replacement text set as \\1-\\2-\\3-\\4-\\5  should also work
This one is even easier and made me think that I should look better at the help notes...

 

Flagged this one as best as it's better for me in my flow 🙂
You should always be aware of different flavours of regulasr expressions. What you did was correct, the syntax was not the one the engine uses when using StringReplacer transformer.

 

FME does some nice flavour mixing on itself btw...

Reply