Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text: Regex to convert Uppercase to Title Case?

I have a bunch of labels in a text file (e.g. MY LABEL:) that I need to make title case.

I already know how I would make them all lower or upper case.

For example:

^([A-Z &#]+:) to \L$1

However, is there a simple switch-based way to get title case?

like image 899
Steve Avatar asked Jul 24 '13 13:07

Steve


People also ask

Does Sublime Text support regex?

Search functions in Sublime Text support regular expressions, a powerful tool for searching and replacing text. Regular Expressions find complex patterns in text.

How do you uppercase in regular expressions?

This can be done easily using regular expressions. In a substitute command, place \U or \L before backreferences for the desired output. Everything after \U , stopping at \E or \e , is converted to uppercase. Similarly, everything after \L , stopping at \E or \e , is converted to lowercase.


1 Answers

Find: ([A-Z])([A-Z]+)\b

Replace: $1\L$2

Make sure case sensitivity is on (Alt + C) and preserve case is off (Alt + A).

like image 152
garyh Avatar answered Sep 21 '22 11:09

garyh