Regular Expression in Calculated Fields?

I have a use case to use the regular expressions in the calculated field. But not finding the regex function in QuickSight.

I see the below posts regarding that. any updates please. It would be great if we have the regex function available soon.

Hi @praveen.gp,
Unfortunately, the β€˜regex’ function, or something similar to, is still a feature limitation in Quick Sight. I had suggested a few work arounds in regards to regex functions at the post below:

If you could explain your scenario that requires this function a bit more in depth, what you’re trying to complete and what an ideal outcome is, I can try and suggest additional work arounds that could be used.

Additionally, I’ll keep this tagged as a feature request to promote visibility to the support team.

I want to capture a value for my field which is only in this format β€˜12-AB-1234’ all the other values should be as β€˜- -’.
I have the other values like β€˜1234’, β€˜New’, Nulls.,
Right now I use contains to capture those required format. But If I have Regex available. The calculated field is straight.

The calculated field Which i am using for my testing. Please suggest if there is any better way to use it.

ifelse(
isNull({Value})
OR toString({Value}) = β€˜0’
OR isNull({Type_CD})
OR {Type_CD} = β€˜0’
OR {Record_Type} = β€˜β€“β€™,
β€˜β€“β€™,
ifelse(
{Type_CD} = β€˜F’,
ifelse(
contains(toString({Value}), β€˜β€“β€™)
OR contains(toString({Value}),β€˜A’) OR contains(toString({Value}),β€˜a’)
OR contains(toString({Value}),β€˜B’) OR contains(toString({Value}),β€˜b’)
OR contains(toString({Value}),β€˜C’) OR contains(toString({Value}),β€˜c’)
OR contains(toString({Value}),β€˜D’) OR contains(toString({Value}),β€˜d’)
OR contains(toString({Value}),β€˜E’) OR contains(toString({Value}),β€˜e’)
OR contains(toString({Value}),β€˜F’) OR contains(toString({Value}),β€˜f’)
OR contains(toString({Value}),β€˜G’) OR contains(toString({Value}),β€˜g’)
OR contains(toString({Value}),β€˜H’) OR contains(toString({Value}),β€˜h’)
OR contains(toString({Value}),β€˜I’) OR contains(toString({Value}),β€˜i’)
OR contains(toString({Value}),β€˜J’) OR contains(toString({Value}),β€˜j’)
OR contains(toString({Value}),β€˜K’) OR contains(toString({Value}),β€˜k’)
OR contains(toString({Value}),β€˜L’) OR contains(toString({Value}),β€˜l’)
OR contains(toString({Value}),β€˜M’) OR contains(toString({Value}),β€˜m’)
OR contains(toString({Value}),β€˜N’) OR contains(toString({Value}),β€˜n’)
OR contains(toString({Value}),β€˜O’) OR contains(toString({Value}),β€˜o’)
OR contains(toString({Value}),β€˜P’) OR contains(toString({Value}),β€˜p’)
OR contains(toString({Value}),β€˜Q’) OR contains(toString({Value}),β€˜q’)
OR contains(toString({Value}),β€˜R’) OR contains(toString({Value}),β€˜r’)
OR contains(toString({Value}),β€˜S’) OR contains(toString({Value}),β€˜s’)
OR contains(toString({Value}),β€˜T’) OR contains(toString({Value}),β€˜t’)
OR contains(toString({Value}),β€˜U’) OR contains(toString({Value}),β€˜u’)
OR contains(toString({Value}),β€˜V’) OR contains(toString({Value}),β€˜v’)
OR contains(toString({Value}),β€˜W’) OR contains(toString({Value}),β€˜w’)
OR contains(toString({Value}),β€˜X’) OR contains(toString({Value}),β€˜x’)
OR contains(toString({Value}),β€˜Y’) OR contains(toString({Value}),β€˜y’)
OR contains(toString({Value}),β€˜Z’) OR contains(toString({Value}),β€˜z’),
toString({Value}),
β€˜β€“β€™
),
toString({Value})
)
)

Hi @praveen.gp,
Apologies for missing your last response on this!
While a bit tedious and long, this logic seems accurate to me, did it work out in your scenario?

Yeah it worked for my scenario.

1 Like