Skip to content

Instantly share code, notes, and snippets.

@dandorman
Created May 20, 2015 04:38
Show Gist options
  • Save dandorman/34a646c23c4df9899fd3 to your computer and use it in GitHub Desktop.
Save dandorman/34a646c23c4df9899fd3 to your computer and use it in GitHub Desktop.
A Ruby regular expression for matching pairs of braces
braces = /\A([^(){}\[\]<>]*)(\((\g<1>\g<2>*\g<1>)\)|\{\g<3>\}|\[\g<3>\]|<\g<3>>)*\g<1>\z/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment