/SwiftyRegex

Linux compatible regex framework written in Swift

Primary LanguageSwiftMIT LicenseMIT

SwiftyRegex Carthage compatible

SwiftyRegex is a regular expression micro framework written in pure Swift. The goal is to make it compatible with Linux and other POSIX compliant systems. Of course don’t use it in apps where you have access to NSRegularExpression.

Example

// Use shorthand operator to test for match
"http://something.com/users/13/profile" =~ "/users/[0-9]"

// Get matching substrings
let words = "RegEx is tough, but useful."
Regex("[a-zA-Z]+").matches(words)

// Replace matching substring
Regex("<name>").replaceIn("Hi <name>.", with: "Jane")

For more see Playground.playground

License

MIT. See the LICENSE for details.