I am trying to replace “ “ and “/” in this column with “_” . How do I frame the regular expression and replacement text?
Solved! Go to Solution.
Hello @MosesAddai24,
The images you posted aren't already doing that? The Original Header(State) seems to have, for example, the text "2 3", and you're replacing the text.
If not, if your data is composed of digits and words, you can use ([\w\d]+)[\s\/]([\w\d]+)
This will:
1. ([\w\d]+) - Group any combination of words and digits
2. [\s\/] - Check if theres a spacebar of a slash
3. ([\w\d]+) - Group again any combination of words and digits
Then for the replacement, just use "$1_$2"
Hope this helps!
This is a Non-Regex way that uses formula to achieve the same goal. Hope it helps. Cheers!
When I used that I got **_** throughout that column. Do I have to change something in the code?
I just tried to replace any white space and slash signs using: [\s\/] in Regular Expression with "_". It should work.
Karolina
It worked! Thank you !
@JoaoLeiteVFYI - \w includes \d already so no need to check for both...
Thanks for the tip @apathetichell! I'll keep that in mind.
I'm glad you were able to get your problem solved, from the screenshot, it seems that you did not give your newly created column a name, hence the error. Cheers!