Hello!
I can’t for the life of me figure out a way to add a whitespace before each Uppercase letter.
I have a text which can look like this: HelloThereEveryone. I want to to become:Hello There Everone
I’ve tried using RegEx [A-Z] as well as for each loop with an if check for Uppercase but I cannot get it to work.
Hi @theEmailRobot ,
Try this:
System.Text.RegularExpressions.Regex.Replace("HelloThereEveryone","(?=[A-Z])"," ").Trim
Regards,
Hi,
How about the following expression?
System.Text.RegularExpressions.Regex.Replace(yourString,"(?=[A-Z])"," ")
Regards,
str1 = “HelloThereEveryone”
Assign: resultText = System.Text.RegularExpressions.Regex.Replace(str1, "[A-Z]", " $0")
Worked! Thanks.
Do you perhaps know how to make it include ALL uppercase letters from different parts of the world? I.E Ä, Æ etc for nordic countries.
Hi,
Can you try the following expression?
System.Text.RegularExpressions.Regex.Replace(yourString,"(?=\p{Lu})"," ").Trim
Regards,
Yes this worked perfectly! Is this regex mixed with .NET or something? It looks really strange to me. I also want to ask if you’re aware how to exclude Uppercase with a Hyphen prefix. I.E “My-Name” not becoming “My- Name”?
Thanks alot for the help!
How about the following?
System.Text.RegularExpressions.Regex.Replace(yourString,"(?<!-)(?=\p{Lu})"," ").Trim
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.



