{"id":13466179,"url":"https://github.com/VerbalExpressions/SwiftVerbalExpressions","last_synced_at":"2025-03-25T21:31:28.854Z","repository":{"id":63921211,"uuid":"20684001","full_name":"VerbalExpressions/SwiftVerbalExpressions","owner":"VerbalExpressions","description":"Swift Port of VerbalExpressions","archived":false,"fork":false,"pushed_at":"2018-04-08T19:50:12.000Z","size":39,"stargazers_count":594,"open_issues_count":2,"forks_count":24,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-03-22T07:04:14.078Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/VerbalExpressions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-10T12:17:16.000Z","updated_at":"2025-03-19T18:49:07.000Z","dependencies_parsed_at":"2023-01-14T14:15:32.871Z","dependency_job_id":null,"html_url":"https://github.com/VerbalExpressions/SwiftVerbalExpressions","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VerbalExpressions%2FSwiftVerbalExpressions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VerbalExpressions%2FSwiftVerbalExpressions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VerbalExpressions%2FSwiftVerbalExpressions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VerbalExpressions%2FSwiftVerbalExpressions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VerbalExpressions","download_url":"https://codeload.github.com/VerbalExpressions/SwiftVerbalExpressions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245547476,"owners_count":20633371,"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":[],"created_at":"2024-07-31T15:00:40.455Z","updated_at":"2025-03-25T21:31:28.572Z","avatar_url":"https://github.com/VerbalExpressions.png","language":"Swift","readme":"SwiftVerbalExpressions\n======================\n\n[![Build Status](https://travis-ci.org/VerbalExpressions/SwiftVerbalExpressions.svg)](https://travis-ci.org/VerbalExpressions/SwiftVerbalExpressions) \n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\n## Swift Regular Expressions made easy\n\nSwiftVerbalExpressions is a Swift library that helps to construct difficult regular expressions - ported from the awesome JavaScript [VerbalExpressions](https://github.com/jehna/VerbalExpressions).\n\n\n## Examples\n\nHere's a couple of simple examples to give an idea of how VerbalExpressions works:\n\n### Testing if we have a valid URL\n\n```swift\n// Create an example of how to test for correctly formed URLs\nlet tester = VerEx()\n    .startOfLine()\n    .then(\"http\")\n    .maybe(\"s\")\n    .then(\"://\")\n    .maybe(\"www\")\n    .anythingBut(\" \")\n    .endOfLine()\n\n// Create an example URL\nlet testMe = \"https://www.google.com\"\n\n// Use test() method\nif tester.test(testMe) {\n    print(\"We have a correct URL\") // This output will fire\n}\nelse {\n    print(\"The URL is incorrect\")\n}\n\n// Use =~ operator\nif testMe =~ tester {\n    print(\"We have a correct URL\") // This output will fire\n}\nelse {\n    print(\"The URL is incorrect\")\n}\n\nprin(tester) // Outputs the actual expression used: \"^(?:http)(?:s)?(?::\\/\\/)(?:www)?(?:[^ ]*)$\"\n```\n\n### Replacing strings\n\n```swift\nlet replaceMe = \"Replace bird with a duck\"\n\n// Create an expression that seeks for word \"bird\"\nlet verEx = VerEx().find(\"bird\")\n\n// Execute the expression like a normal RegExp object\nlet result = verEx.replace(replaceMe, with: \"duck\")\n\nprint(result) // Outputs \"Replace duck with a duck\"\n```\n\n### Shorthand for string replace:\n\n```swift\nlet result2 = VerEx().find(\"red\").replace(\"We have a red house\", with: \"blue\")\n\nprint(result2) // Outputs \"We have a blue house\"\n```\n\n\n## API documentation\n\nYou can find the documentation for the original JavaScript repo on their [wiki](https://github.com/jehna/VerbalExpressions/wiki).\n\n\n## Contributions\n\nClone the repo and fork!\nPull requests are warmly welcome!\n\n\n## Thanks!\n\nThank you to @jehna for coming up with the awesome original idea!  \nThank you to @kishikawakatsumi for ObjectiveCVerbalExpressions from which I borrowed some code!\n\n\n## Other implementations\n\nYou can view all implementations on [VerbalExpressions.github.io](http://VerbalExpressions.github.io)\n\n\n## Installation and use\n\nThis version is under testing, but it supports Swift Package Manager. Therefore it can be included in the project with:\n\n```\n        .package(\n            url: \"https://github.com/VerbalExpressions/SwiftVerbalExpressions.git\",\n            from: \"\n\n```\n\nAnd:\n\n```\n        .target(\n            name: \"YourProject\",\n            dependencies: [\"VerbalExpressions\"]),\n```\n","funding_links":[],"categories":["Libs","Text [🔝](#readme)","Misc","etc"],"sub_categories":["Text","Natural Language Processing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVerbalExpressions%2FSwiftVerbalExpressions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVerbalExpressions%2FSwiftVerbalExpressions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVerbalExpressions%2FSwiftVerbalExpressions/lists"}