Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meniny/re
🔫 Pythonic RegEx library.
https://github.com/meniny/re
python pythonic re regex regexp regular-expression swift
Last synced: 15 days ago
JSON representation
🔫 Pythonic RegEx library.
- Host: GitHub
- URL: https://github.com/meniny/re
- Owner: Meniny
- License: mit
- Created: 2018-04-28T09:44:35.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-11T14:18:14.000Z (almost 6 years ago)
- Last Synced: 2024-04-20T08:02:30.241Z (10 months ago)
- Topics: python, pythonic, re, regex, regexp, regular-expression, swift
- Language: Swift
- Homepage:
- Size: 23.4 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE.md
Awesome Lists containing this project
README
= Meet `re`
++++
++++== 🏵 Introduction
**re**, a tiny Pythonic RegEx library.
Learn more about link:https://docs.python.org/2/library/re.html[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 link:https://cocoapods.org[CocoaPods].
[source, ruby]
----
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
[source, swift]
----
import relet string: String = ...
let pattern: String = ...
----[source, swift]
----
// 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)
----[source, swift]
----
// 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)
// ...
----