David542
David542

Reputation: 110412

How to uppercase $1 output

I am trying to uppercase the output in a find/replace statement in TextMate. Here is what I have to isolate the text:

Find: (uv.+)
Replace: $1

How would I do: "$1".upper()

Input:
https://store.playstation.com/#!/en-us/movies/cid=uv0012-npvb22701_cn-0000000000307457

Desired Output:
https://store.playstation.com/#!/en-us/movies/cid=UV0012-NPVB22701_CN-0000000000307457

Upvotes: 1

Views: 1189

Answers (1)

user707650
user707650

Reputation:

From the manual, section 20.4.2:

It is possible to convert the next character to upper or lowercase by prepending it with \u or \l. This is mainly useful when the next character stems from a capture register. Example:

Find: (<a.*?>)(.*?)(</a>) 
Replace: $1\u$2$3 

You can also convert a longer sequence to upper or lowercase by using \U or \L and then \E to disable the case folding again. Example:

Find: (<a.*?>)(.*?)(</a>) 
Replace: $1\U$2\E$3

Upvotes: 5

Related Questions