Skip to content

Instantly share code, notes, and snippets.

@cpgillem
Created February 8, 2018 17:06
Show Gist options
  • Select an option

  • Save cpgillem/5b6fcc228f7a98ab84d3274fa4f2b04e to your computer and use it in GitHub Desktop.

Select an option

Save cpgillem/5b6fcc228f7a98ab84d3274fa4f2b04e to your computer and use it in GitHub Desktop.
Cursed regex for identifying the parts of imperial unit strings that match the format [x' y"] or [y"]
^(?:(?<fq>-?\d+)\s*(?<fu>\'|f(?:ee)?t\.?))?\s*(?<iq>(?:\d+\s+)?\d+\/\d+|\d*\.\d+|\d+)\s*(?<iu>\"|''|in(?:ches|\.?))$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment