Skip to main content
Solved

Insert a space before a capital letter

  • April 20, 2024
  • 2 replies
  • 162 views

JM1234

Hi I have a file name / string of text

e.g. 'ThisIsTheFileName'

I would like to insert a space before each capital letter. Is there a formula to do this?

Thanks 

Best answer by kuovonne

Try something like this. I’m not on a computer so I cannot test it to be sure.

I got to a computer and tested it out. There was a typo in the regex function name (which I have fixed), but the logic (and the regex pattern itself) was good. By the way, I'm assuming that you do not want a space before the first capital letter.

 

TRIM( REGEX_REPLACE( {Name}, "([A-Z])", " $1" ) )

 

 

 


 

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • Answer
  • April 21, 2024

Try something like this. I’m not on a computer so I cannot test it to be sure.

I got to a computer and tested it out. There was a typo in the regex function name (which I have fixed), but the logic (and the regex pattern itself) was good. By the way, I'm assuming that you do not want a space before the first capital letter.

 

TRIM( REGEX_REPLACE( {Name}, "([A-Z])", " $1" ) )

 

 

 


 


JM1234
  • Author
  • May 3, 2024

Thanks v much!