A function to identify and remove multiple spaces between words
Marco_13112001
Member
Good morning,
I've build the following function to identify and remove multiple spaces between words, however it is not working. Am I missing any step?
Many thanks in anticipation for our support.
Best regards,
Marco
0
Best Answers
-
Hi Marco,
Regex can be very useful in certain cases but for this example there is a very simple way to reduce the spaces. Within the native functions
you can use Compact Spaces. There is also Trim to remove characters at the beginning or end.
Checking if the spaces have been reduced can be done with Length. Here is an example:2 -
I agree with the answer to use Compact spaces in this instance, but did look at this for my understanding.
Your regex is selecting the entire string not just the multiple spaces:
https://regex101.com/
It should be just the middle part:1