🔫 Pythonic RegEx library.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sample
re
.gitignore
LICENSE.md
README.adoc
_config.yml
re.podspec

README.adoc

Meet re

🏵 Introduction

re, a tiny Pythonic RegEx library.

Learn more about re module in Python 2.x.

📋 Requirements

  • iOS 8.0+

  • macOS 10.9+

  • tvOS 9.0+

  • watchOS 2.0+

  • Xcode 9.0+ with Swift 4.1+

📲 Installation

re is available on CocoaPods.

use_frameworks!
pod 're'

❤️ Contribution

You are welcome to fork and submit pull requests.

🔖 License

re is open-sourced software, licensed under the MIT license.

🔫 Usage

import re

let string: String = ...
let pattern: String = ...
// Swiftly
let regex = RegularExpression.of(pattern)

let matches = regex.matches(in: string)
let groups1 = regex.groups(matches: string)
let groups2 = regex.groups(matches: string, at: 1)
let groups3 = regex.groups(matches: string, at: [1, 2])
let split = regex.split(string)
let replace = regex.replace(with: "BEING_REPLACED", in: string)
// Pythonic
let _ = re.compile(pattern, flags: [])

let _ = re.search(pattern, string)
let _ = re.match(pattern, string)
let _ = re.split(pattern, string)
let _ = re.sub(pattern, string)
// ...