I’m trying to output a formatted string, but struggling to find a clean formula.
If the input was:
Hello. I'm "___BOB___"! I'm feeling happy / healthy
I want the output to be:
hello_im_bob_im_feeling_happy_healthy
So basically:
All spaces should be replaced with underscores
All special characters (except for underscores) should be removed
There should never be more than 1 underscore in a row
I’ve got it mostly working with the following
Lower(
ReplaceRegex(
ReplaceRegex(
"Hello. I'm "___BOB___"! I'm feeling happy / healthy", "[\s_]+", "_"),
"[^a-zA-Z0-9_]", "")
)
but it still spits out the following (based on my example):
hello_im__bob__im_feeling_happy__healthy
As you can see there’s a few spots that have double underscores.
How can I ensure the final output doesn’t have more than 1 underscore in a row? ChatGTP keeps giving me solutions that don’t seem to work in Fibery’s approved RegEx format.
Bonus points if it can all be done in a single ReplaceRegex function instead of needing to nest them!