Skip to content

Instantly share code, notes, and snippets.

@pilotmoon
Created June 3, 2022 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pilotmoon/4977625377674a10868621e60c7e6c69 to your computer and use it in GitHub Desktop.
Save pilotmoon/4977625377674a10868621e60c7e6c69 to your computer and use it in GitHub Desktop.
PopClip extension to swap "Doe, John" to "John Doe"
#popclip
name: Swap Name
icon: symbol:arrow.triangle.swap
after: paste-result
regex: '\w+, .+'
javascript: |
const match = popclip.input.text.match(/(\w+), (.+)/)
if (match) return match[2] + ' ' + match[1]; else return null
# The above block is an Extension SNippet - select it to install the extension with PopClip
# see https://forum.popclip.app/t/introducing-extension-snippets/309
# Test inputs:
# Bush, George
# Bush, George Herbert Walker
# Bush, George H. W.
# Smith-Smythe-Smith, Tarquin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment