{"id":23045130,"url":"https://github.com/henoc/regex-refined","last_synced_at":"2026-04-28T11:03:07.973Z","repository":{"id":57719925,"uuid":"156374028","full_name":"henoc/regex-refined","owner":"henoc","description":"Refinement types for regex","archived":false,"fork":false,"pushed_at":"2018-11-23T17:28:28.000Z","size":170,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T16:13:38.819Z","etag":null,"topics":["refinement-types","regex","scala"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/henoc.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":"2018-11-06T11:35:00.000Z","updated_at":"2018-12-07T11:15:27.000Z","dependencies_parsed_at":"2022-09-26T22:30:35.036Z","dependency_job_id":null,"html_url":"https://github.com/henoc/regex-refined","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henoc%2Fregex-refined","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henoc%2Fregex-refined/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henoc%2Fregex-refined/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henoc%2Fregex-refined/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/henoc","download_url":"https://codeload.github.com/henoc/regex-refined/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246922232,"owners_count":20855343,"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":["refinement-types","regex","scala"],"created_at":"2024-12-15T21:18:34.922Z","updated_at":"2026-04-28T11:03:02.940Z","avatar_url":"https://github.com/henoc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# regex-refined\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.henoc/regex-refined_2.12.svg)](http://mvnrepository.com/artifact/com.github.henoc/regex-refined_2.12)\n[![License](https://img.shields.io/badge/license-GPL%2BCE-blue.svg)](https://openjdk.java.net/legal/gplv2+ce.html)\n\n[refined](https://github.com/fthomas/refined) for regex string, and some type-safe regex utilities.\n\n## build.sbt\n\n```sbt\nlibraryDependencies += \"com.github.henoc\" %% \"regex-refined\" % \"0.1.0\"\n```\n\n## Usage\n\n### Refinement\n\nThere are more examples in test files.\n\n```scala\nimport regex_string._\nimport eu.timepit.refined.api._\nimport eu.timepit.refined.W\nimport eu.timepit.refined.generic.Equal\nimport eu.timepit.refined.auto._\n\n// Regex string should have one caputuring-group\nval _: String Refined GroupCount[Equal[W.`1`.T]] = \"a(b)c\"\n\n// Regex string should have a group name \"integer\"\nval _: String Refined HasGroupName[W.`\"integer\"`.T] = \"[+-]?((?\u003cinteger\u003e[0-9]*)[.])?[0-9]+\"\n\n// Regex string should be full match pattern\nval _: String Refined FullMatchPattern = \"^abc$\"\n\n// Regex string should be correct as js-regex\nval _: String Refined JsRegex = \"\"\"abx[\\b]cde\"\"\"\n```\n\n### Pattern matching\n\n`r` string interpolator extractor checks the number of groups in compile time.\n\n```scala\n\"2018-11-18\" match {\n  case r\"\"\"(\\d+$year)-(\\d+$month)-(\\d+$day)\"\"\" =\u003e println(s\"year = $year, month = $month, day = $day\")\n  case _ =\u003e println(\"no!\")\n}\n```\n\nThe variable positions of interpolator is not concerned, so you can also write:\n\n```scala\nr\"\"\"(\\d+)-(\\d+)-(\\d+)$year$month$day\"\"\"\nr\"\"\"(?x)   (\\d+)-(\\d+)-(\\d+)    # $year, $month, $day\"\"\"\n```\n\nBut this throws compile error:\n\n```scala\nr\"\"\"(?x)   (\\d+)-(\\d+)-\\d+    # $year, $month, $day\"\"\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenoc%2Fregex-refined","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenoc%2Fregex-refined","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenoc%2Fregex-refined/lists"}