1

Hello everyone i have some texts that looks like this

  • jameskach --> JamesKach
  • firefighter11 --> FireFighter11
  • attackontitan --> AttackOnTitan
  • lazyperson --> LazyPerson

Not all the texts are the same, i was just showing some examples, any help is appreciated

Toto
  • 89,455
  • 62
  • 89
  • 125
ramza75
  • 65
  • 1
  • 7
  • (\w+) replace with \u$0 this one only does the first letter of the word, so like it turns attackontitan to Attackontitan and i need it to be AttackOnTitan – ramza75 Aug 20 '17 at 16:16
  • How could you know what letter must be uppercased in `attackontitan`? I don't think it is possibel. – Toto Aug 20 '17 at 16:18

1 Answers1

6

Regex to match & group first character :

^(.)

What to replace with :

\U\1

(the \1 means the first matching group.)

Seblor
  • 6,947
  • 1
  • 25
  • 46
  • This works great, but doesnt capitalize every first letter in the sentence, so like attackontitan turns into Attackontitan but i need to turn into AttackOnTitan – ramza75 Aug 20 '17 at 16:19
  • 2
    Well that case is not possible. You would need to include a whole full dictionary into the regex which is *absolutely not* good. – Seblor Aug 20 '17 at 16:20
  • Also, from a dictionary : `Words are usually separated by spaces in writing, and are distinguished phonologically, as by accent, in many languages.` So you should find your answer here : https://stackoverflow.com/questions/195010/how-can-i-split-multiple-joined-words – Seblor Aug 20 '17 at 16:22