By email:
Feature request:
An extension that upper cases the first word of each sentence and line, but leaves the rest of the letters alone. Sentence Case doesn’t work for this because it changes everything else to lower case, and also doesn’t uppercase the first word of a line. One use case: if I have a list and I want to capitalize each item. Maybe it should be called Poetry Case?
Example, from:
list item A
list item B
list item CTo:
List item A
List item B
List item C
My solution
#popclip
name: Poetry Case
icon: PC
after: paste-result
javascript: |
const regex = /(^[^\p{L}]*\p{L}{1})/gum
return popclip.input.text.replace(regex, match => match.toUpperCase())
(The above block is an extension snippet - select it to install the extension with PopClip)
Notes
- Had some trouble thinking of a good icon…
- The regex looks quite imposing. It matches everything up to and including the first letter character (
\p{L}
) of each line. Note that theu
flag on the regex is needed to enable this\p{}
construction, and them
flag makes^
match the start of lines. I used https://regex101.com/r/FxemMU/1 to test the regex
Demo