{"id":18916662,"url":"https://github.com/senocak/regexpbuilderkotlin","last_synced_at":"2026-03-11T01:30:18.367Z","repository":{"id":210758777,"uuid":"727365195","full_name":"senocak/regexpbuilderkotlin","owner":"senocak","description":"🦉 human-readable regular expressions","archived":false,"fork":false,"pushed_at":"2023-12-04T19:32:31.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T15:15:56.499Z","etag":null,"topics":["kotlin","kotlin-library","regex"],"latest_commit_sha":null,"homepage":"https://github.com/gherkins/regexpbuilderphp","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/senocak.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-12-04T18:08:33.000Z","updated_at":"2023-12-05T07:54:21.000Z","dependencies_parsed_at":"2023-12-04T20:26:54.787Z","dependency_job_id":"f23dee1f-7427-433e-a927-d3a905e461a2","html_url":"https://github.com/senocak/regexpbuilderkotlin","commit_stats":null,"previous_names":["senocak/regexpbuilderkotlin"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senocak%2Fregexpbuilderkotlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senocak%2Fregexpbuilderkotlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senocak%2Fregexpbuilderkotlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senocak%2Fregexpbuilderkotlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/senocak","download_url":"https://codeload.github.com/senocak/regexpbuilderkotlin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239908892,"owners_count":19716873,"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":["kotlin","kotlin-library","regex"],"created_at":"2024-11-08T10:20:58.459Z","updated_at":"2026-03-11T01:30:18.224Z","avatar_url":"https://github.com/senocak.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"```asciidoc\n ____            _____            ____        _ _     _          \n|  _ \\ ___  __ _| ____|_  ___ __ | __ ) _   _(_) | __| | ___ _ __\n| |_) / _ \\/ _` |  _| \\ \\/ / '_ \\|  _ \\| | | | | |/ _` |/ _ \\ '__\n|  _ \u003c  __/ (_| | |___ \u003e  \u003c| |_) | |_) | |_| | | | (_| |  __/ |  \n|_| \\_\\___|\\__, |_____/_/\\_\\ .__/|____/ \\__,_|_|_|\\__,_|\\___|_|  \n           |___/           |_|                                   \n```\n## human-readable regular expressions for Jvm\n[![release](https://img.shields.io/github/v/release/senocak/regexpbuilderkotlin.svg?style=flat-square)](https://img.shields.io/github/v/release/senocak/regexpbuilderkotlin/releases)\n[![phpunit](https://img.shields.io/github/actions/workflow/status/senocak/regexpbuilderkotlin/main.yml?style=flat-square\u0026color=lightgreen)](https://github.com/senocak/regexpbuilderphp/actions)\n[![release](https://img.shields.io/badge/coverage-100%25-lightgreen?style=flat-square)](https://github.com/senocak/regexpbuilderkotlin/releases)\n![release](https://img.shields.io/badge/much-wow-lightgreen?style=flat-square)\n\n\u003e RegExpBuilder integrates regular expressions into the programming language, thereby making them easy to read and maintain. Regular Expressions are created by using chained methods and variables such as arrays or strings.\n\n## Installation\n\n```bash\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n```bash\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.senocak\u003c/groupId\u003e\n    \u003cartifactId\u003eregexpbuilderkotlin\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nOr download [the appropriate release](https://github.com/senocak/regexpbuilderkotlin/releases/latest)\nand require [RegExpBuilder.kt](lib/src/main/kotlin/com/github/senocak/regexb/RegExpBuilder.kt) and [RegExp.kt](lib/src/main/kotlin/com/github/senocak/regexb/RegExp.kt)\n\n\n## Examples\n\n### Validation\n\n```kotlin\nval regExp1: RegExp = RegExpBuilder()\n        .startOfInput()\n        .startOfInput()\n        .exactly(n = 4).digits()\n        .then(s = \"_\")\n        .exactly(n = 2).digits()\n        .then(s = \"_\")\n        .min(n = 3).max(n = 10).letters()\n        .then(s = \".\")\n        .anyOf(r = listOf(\"png\", \"jpg\", \"gif\"))\n        .endOfInput()\n        .getRegExp()\n        .also { it: RegExp -\u003e\n            // True\n            println(it.matches(inputString0 = \"2020_10_hund.jpg\"))\n            println(it.matches(inputString0 = \"2030_11_katze.png\"))\n            println(it.matches(inputString0 = \"4000_99_maus.gif\"))\n            // False\n            println(it.matches(inputString0 = \"123_00_nein.gif\"))\n            println(it.matches(inputString0 = \"4000_0_nein.pdf\"))\n            println(it.matches(inputString0 = \"201505_nein.jpg\"))\n        }\n```\n\n### Search\n\n```kotlin\nval regExp2: RegExp = RegExpBuilder()\n    .multiLine()\n    .globalMatch()\n    .min(n = 1).max(n = 10).anythingBut(s = \" \")\n    .anyOf(r = listOf(\".pdf\", \".doc\"))\n    .getRegExp()\n    .also { it: RegExp -\u003e\n        val text = \"\"\"Lorem ipsum dolor sit amet, consetetur sadipscing elitr,\nsed diam nonumy SomeFile.pdf eirmod tempor invidunt ut labore et dolore\nmagna aliquyam erat, sed diam voluptua. At vero eos et accusam lorem\net justo duo dolores et ea rebum. doc_04.pdf Stet clita kasd File.doc.\"\"\"\n        val matches: List\u003cString\u003e = it.findIn(inputString0 = text)\n        println(matches[0] == \"SomeFile.pdf\")\n        println(matches[1] == \"doc_04.pdf\")\n        println(matches[2] == \"File.doc\")\n    }\n```\n\n### Replace\n\n```kotlin\nval regExp3: RegExp = RegExpBuilder()\n    .min(n = 1)\n    .max(n = 10)\n    .digits()\n    .getRegExp()\n    .also { it: RegExp -\u003e\n        var text = \"98 bottles of beer on the wall\"\n        text = it.replace(inputString0 = text) { match: String -\u003e (match.toInt() + 1).toString() }\n        println(\"99 bottles of beer on the wall\" == text)\n```\n\n### Validation with multiple patterns\n\n```kotlin\nval regExp41: RegExpBuilder = RegExpBuilder()\n    .startOfInput()\n    .exactly(n = 3).digits()\n    .anyOf(r = listOf(\".pdf\", \".doc\"))\n    .endOfInput()\n\nval regExp42: RegExpBuilder = RegExpBuilder()\n    .getNew()\n    .startOfInput()\n    .exactly(n = 4).letters()\n    .then(s = \".jpg\")\n    .endOfInput()\n\nval regExp43: RegExp = RegExpBuilder()\n    .getNew()\n    .eitherFind(r = regExp41)\n    .orFind(r = regExp42)\n    .getRegExp()\n\n//true\nprintln(regExp43.matches(inputString0 = \"123.pdf\"))\nprintln(regExp43.matches(inputString0 = \"456.doc\"))\nprintln(regExp43.matches(inputString0 = \"bbbb.jpg\"))\nprintln(regExp43.matches(inputString0 = \"aaaa.jpg\"))\n\n//false\nprintln(regExp43.matches(inputString0 = \"1234.pdf\"))\nprintln(regExp43.matches(inputString0 = \"123.gif\"))\nprintln(regExp43.matches(inputString0 = \"aaaaa.jpg\"))\nprintln(regExp43.matches(inputString0 = \"456.docx\"))\n```\n\nTake a look at the [tests](lib/src/test/kotlin/com/github/senocak/regexb/LibraryTest.kt) for more examples\n\n# ALL Thanks to https://github.com/gherkins/regexpbuilderphp","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenocak%2Fregexpbuilderkotlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsenocak%2Fregexpbuilderkotlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenocak%2Fregexpbuilderkotlin/lists"}