Regex convert string

I have a text field (FIX) with a value of "5450"
I would like to convert this field to "54N50W"

I'm sure I can do this with RegEx. Can not seem to get it right.

I apologize in advance. RegEx has always been a bit of a problem for me (I'm working on it)
Thank you.

@Timothy_Treaster is the input value always 5450 and is the output always supposed to be 54N50W? Or is there some variability to it?

I would do something like this:

{formtext: default=5450; name=FIX}
{=concat(left(FIX, 2),"N",right(FIX,2),"W")}

That is getting the first 2 characters from the field called "FIX", adding an "N", getting the last 2 characters from "FIX" and then adding a "W". It'd work for any 4 character string entered into the "FIX" box, always adding the N and W as described.

If there needs to be more variability respond here with how and I can make a new version.

1 Like

Wow, that was easy. You got it right, the field always has 4 chars. I was so involved with figuring out a RegEx solution that I did not even think about a simple concat() answer. Thank you so much for your assistance! I got it from here. You have made my day much easier!

1 Like