-
-
Save njm2112/5bb3471b0734824a2357ddc5f0e7e16e to your computer and use it in GitHub Desktop.
A TextExpander snippet to convert clipboard contents: "Straight" quotes to “curly”, double-hyphens to em-dashes and three periods to ellipses.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$str = `pbpaste`; | |
$str = preg_replace('/(^|[-\xe2\x80\x94\/(\[{"\s])\'/', "$1\xe2\x80\x98", $str); | |
$str = preg_replace('/\'/', "\xe2\x80\x99", $str); | |
$str = preg_replace('/(^|[-\xe2\x80\x94\/(\[{\xe2\x80\x98\s])"/', "$1\xe2\x80\x9c", $str); | |
$str = preg_replace('/"/', "\xe2\x80\x9d", $str); | |
$str = preg_replace('/--/', "\xe2\x80\x94", $str); | |
$str = preg_replace('/\.\.\./', "\xe2\x80\xa6", $str); | |
echo $str; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment