Skip to content

Instantly share code, notes, and snippets.

@hartbit
Created November 15, 2014 16:14
Show Gist options
  • Save hartbit/fa006732cdd1faeebb94 to your computer and use it in GitHub Desktop.
Save hartbit/fa006732cdd1faeebb94 to your computer and use it in GitHub Desktop.
Regex
// without double escapes: \A([^{}]*)(?:\{([^{}/]*)(?:\/([^{}/]*))+\})?([^{}]*)\z
let formatRegex = NSRegularExpression(pattern: "\\A([^{}]*)(?:\\{([^{}/]*)(?:/([^{}/]*))+\\})?([^{}]*)\\z", options: .allZeros, error: nil)
let test = "In this line {this should be captured/and this but it isn’t/and finally this}. I don’t understand."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment