hadenp
hadenp

Reputation: 445

Regex Syntax for making the last character Uppercase in TextMate

I want to uppercase the last character in a address field. So for "300 E.87th St. #4b" becomes "300 E.87th St. #4B", but "87th" should not change to 87Th. Can I do that in TextMate? If so, what's the syntax?

Thanks.

Upvotes: 4

Views: 952

Answers (1)

hadenp
hadenp

Reputation: 445

The solution was to simply to have two captures in the Find field: ([0-9])([a-z])$ and include both of them in the Replace: $1\U$2.

Kind of obvious, I guess. This was the first time I've needed regex and was trying to solve a problem while learning the basics, a situation that is doubtless quite common!

Upvotes: 6

Related Questions