{"id":16683853,"url":"https://github.com/meniny/colaexpression","last_synced_at":"2025-04-09T23:25:14.978Z","repository":{"id":56906222,"uuid":"97234636","full_name":"Meniny/ColaExpression","owner":"Meniny","description":"💻A regular expression framework written in Swift.","archived":false,"fork":false,"pushed_at":"2019-04-06T08:37:08.000Z","size":838,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T22:46:41.853Z","etag":null,"topics":["regex","regular-expression","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Meniny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-14T13:05:12.000Z","updated_at":"2019-04-06T08:36:47.000Z","dependencies_parsed_at":"2022-08-21T03:20:52.741Z","dependency_job_id":null,"html_url":"https://github.com/Meniny/ColaExpression","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FColaExpression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FColaExpression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FColaExpression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FColaExpression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Meniny","download_url":"https://codeload.github.com/Meniny/ColaExpression/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248127589,"owners_count":21052253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["regex","regular-expression","swift"],"created_at":"2024-10-12T14:26:45.141Z","updated_at":"2025-04-09T23:25:14.938Z","avatar_url":"https://github.com/Meniny.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://i.loli.net/2017/08/03/5982cf95ad718.png\" alt=\"ColaExpression\"\u003e\n  \u003cbr/\u003e\u003ca href=\"https://cocoapods.org/pods/ColaExpression\"\u003e\n  \u003cimg alt=\"Version\" src=\"https://img.shields.io/badge/version-2.2.0-brightgreen.svg\"\u003e\n  \u003cimg alt=\"Author\" src=\"https://img.shields.io/badge/author-Meniny-blue.svg\"\u003e\n  \u003cimg alt=\"Build Passing\" src=\"https://img.shields.io/badge/build-passing-brightgreen.svg\"\u003e\n  \u003cimg alt=\"Swift\" src=\"https://img.shields.io/badge/swift-5.0%2B-orange.svg\"\u003e\n  \u003cbr/\u003e\n  \u003cimg alt=\"Platforms\" src=\"https://img.shields.io/badge/platform-macOS%20%7C%20iOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20Linux-lightgrey.svg\"\u003e\n  \u003cimg alt=\"MIT\" src=\"https://img.shields.io/badge/license-MIT-blue.svg\"\u003e\n  \u003cbr/\u003e\n  \u003cimg alt=\"Cocoapods\" src=\"https://img.shields.io/badge/cocoapods-compatible-brightgreen.svg\"\u003e\n  \u003cimg alt=\"Carthage\" src=\"https://img.shields.io/badge/carthage-working%20on-red.svg\"\u003e\n  \u003cimg alt=\"SPM\" src=\"https://img.shields.io/badge/swift%20package%20manager-working%20on-red.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n***\n\n## What's this?\n\n`ColaExpression` is a Cross-Platform Regular Expression Library written in Swift.\n\n## Requirements\n\n* iOS 9.0+\n* macOS 10.10+\n* watchOS 3.0+\n* tvOS 9.0+\n* Xcode 9 with Swift 4\n\n## Installation\n\n#### CocoaPods\n\n```ruby\npod 'ColaExpression'\n```\n\n## Contribution\n\nYou are welcome to fork and submit pull requests.\n\n## License\n\n`ColaExpression` is open-sourced software, licensed under the `MIT` license.\n\n## Usage\n\n#### `isMatch() -\u003e Bool`\n\n```swift\nlet pattern = \"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Za-z]{2,6}\"\nlet str = \"admin@meniny.cn\"\n```\n\n```swift\nlet cola = ColaExpression(pattern)\nif cola.isMatch(with: str) {\n  print(\"\\(str) is a valid email\")\n  // admin@meniny.cn is a valid email\n}\n```\n\n```swift\nif str.isMatch(pattern: pattern) {\n  print(\"\\(str) is a valid email\")\n  // admin@meniny.cn is a valid email\n}\n```\n\n#### `matches() -\u003e [String]`\n\n```swift\nlet pattern = \"[a-z]{3}\"\nlet str = \"AAAbbbCCCdddEEEfff\"\n```\n\n```swift\nlet cola = ColaExpression(pattern)\nlet matches = cola.matches(of: str)\n// [\"bbb\", \"ddd\", \"fff\"]\n```\n\n```swift\nlet matches = str.matches(pattern: pattern)\n// [\"bbb\", \"ddd\", \"fff\"]\n```\n\n#### `replaceOccurences() -\u003e String`\n\n```swift\nlet pattern = \"[a-z]\"\nlet str = \"AAAbbbCCCdddEEEfff\"\nlet replacement = \"-\"\n```\n\n```swift\nlet cola = ColaExpression(pattern)\nlet replaced = cola.replaceOccurences(in: str, with: replacement)\n// AAA---CCC---EEE---\n```\n\n```swift\nlet replaced = str.replaceOccurences(matches: pattern, with: replacement)\n// AAA---CCC---EEE---\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeniny%2Fcolaexpression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeniny%2Fcolaexpression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeniny%2Fcolaexpression/lists"}