AnsweredAssumed Answered

How To Replace a Group With RegEx?

Question asked by rhia Champion on Apr 18, 2018
Latest reply on Apr 20, 2018 by emha

Hey folks!


(And probably, specifically Marian Hatala, N M)


I'm not great with RegEx. I want to use the Replace() functionality to, if a single line of text matches a RegEx pattern, to turn it to a word. 


Using an example here, but basically:


SLT:  32.44


RegEx: ^(\d\d\.)\d\d$


Now, if I were to put that RegEx into the "Regular Expression" validation portion of the SLT, it's valid - that's rad. Great. If not, maybe just the number appears, or maybe it's blank. Whatever, doesn't matter to me.




I want to put it into this calculated field as, for example, replace(SLT, "^(\d\d\.)\d\d$", "yes this format is correct") 


The goal is to have a specific word appear if the formatting matches the RegEx. 


Thanks for any help that can be offered!

(The overall goal here, if you're curious, is that we have specific validation formatting required if it's imperial vs metric, but it's also all within the same text field. If you have better ideas, I am all ears.)