Hello,
I need a regular expression that transforms expressions like this:
40304023
Into this:
40-304-023
Thank you.
Solved! Go to Solution.
I think this should work, given your example.
ReverseString(REGEX_Replace(
ReverseString(ToString([Field1])),
"(\d{3})(\d{3})(\d{2})","$1-$2-$3"))
Hi @BautistaC888 !
Always have that pattern?( lenght, only numbers)
If yes, you don't need regex, can use string formulas for it, like:
left([field1],2)+"-"+substring([field1],3,3)+"-"+right([field1],3)
Hope that helps!
I should note that my solution above is overly complicated, if you just have 8 digits every time, but the format allows you to expand on the RegEx to deal with other scenarios. If it is always 8 digits, you could essentially work it left to right to accomplish the same thing:
Regex_Replace(ToString([Field1]),'(\d{2})(\d{3})(\d{2})','$1-$2-$3')
No, the patterns are different.
Can share with us some examples of how can appear in you dataset?
@BautistaC888 , How are they different? What are the limitations? We would need the parameters, if you want the solution to handle different sized inputs.
Here is an example.
@BautistaC888 , I think you may have forgotten to attach a file or accidentally deleted text from your response--I'm not seeing anything.
User | Count |
---|---|
19 | |
15 | |
13 | |
9 | |
8 |