Skip to main content

Hi all

I have an attribute whose values are all written in PascalCase, for example "PleaseHelpMeOutHere".

I'd like to add a space at any capital letter, making a more readable string "Please Help Me Out Here". I don't need to preserve the original attribute.

To make it a little more complicated, some attributes have more than one capital letter, which I'd like to preserve (except for the last capital, which denotes a new word). For example "SOSHelpMeOutHere" becomes "SOS Help Me Out Here"

My guess would be that using a StringReplacer with Regex would work, but Regex is a foreign language to me. I could always use a PythonCaller, but I'd prefer to avoid that if possible.

Thanks

Hi @ld, assuming that only English alphabet characters would appear, the StringReplacer with this setting might help you.

  • Mode: Replace Regular Expression
  • Case Sensitive: Yes
  • Text To Replace: (?<=.)([A-Z][a-z])
  • Replacement Text: <space>\\1

Replace the '<space>' with an actual space character.


Reply