Skip to content

Instantly share code, notes, and snippets.

@Mikulas
Created March 1, 2012 19:27
Show Gist options
  • Save Mikulas/1952480 to your computer and use it in GitHub Desktop.
Save Mikulas/1952480 to your computer and use it in GitHub Desktop.
Typography replacements (xkcd #37)
Replace space thousand separator with thin space (insert if no separator) ~(\d) ?(?=([0-9]{3})+\b)~ ~$1  ~
Replace multiplication x with symbol ~(\b[0-9]+)\s*x\s*([0-9]+)\b~ ~$1×$2~
Ellipses ~\.\.\.~ ~…~
Separate hyphens in ranges with dash ~(\d+)-(\d+)~ ~$1–$2~
Format dates properly (add nonbreaking spaces, remove leading zeros) ~0?(\d{1,2})\.0?(\d{1,2})\.(\d{2})~ ~$1. $2. $3~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment