{"id":33231753,"url":"https://github.com/telekons/one-more-re-nightmare","last_synced_at":"2025-11-16T19:01:20.597Z","repository":{"id":44655542,"uuid":"269858483","full_name":"telekons/one-more-re-nightmare","owner":"telekons","description":"A fast regular expression compiler in Common Lisp","archived":false,"fork":false,"pushed_at":"2024-05-07T10:03:13.000Z","size":320,"stargazers_count":135,"open_issues_count":7,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-19T05:35:14.822Z","etag":null,"topics":["common-lisp","compiler","lisp","regex","regular-expression-engine"],"latest_commit_sha":null,"homepage":"https://applied-langua.ge/projects/one-more-re-nightmare/","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/telekons.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-06T03:46:42.000Z","updated_at":"2024-05-09T02:42:25.000Z","dependencies_parsed_at":"2024-05-07T11:25:42.443Z","dependency_job_id":"37333ebe-e388-4142-ab11-14dcefde4e9b","html_url":"https://github.com/telekons/one-more-re-nightmare","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/telekons/one-more-re-nightmare","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekons%2Fone-more-re-nightmare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekons%2Fone-more-re-nightmare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekons%2Fone-more-re-nightmare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekons%2Fone-more-re-nightmare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telekons","download_url":"https://codeload.github.com/telekons/one-more-re-nightmare/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekons%2Fone-more-re-nightmare/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284759739,"owners_count":27058842,"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","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["common-lisp","compiler","lisp","regex","regular-expression-engine"],"created_at":"2025-11-16T18:00:20.905Z","updated_at":"2025-11-16T19:01:20.592Z","avatar_url":"https://github.com/telekons.png","language":"Common Lisp","funding_links":[],"categories":["Python ##","Interfaces to other package managers"],"sub_categories":["Third-party APIs"],"readme":"# one-more-re-nightmare\n\none-more-re-nightmare is a regular expression engine that uses the\ntechnique presented in [Regular-expression derivatives\nrevisited](https://www.ccs.neu.edu/home/turon/re-deriv.pdf) to\ninterpret and compile regular expressions. We use a few tricks to make\nmatching quite fast:\n\n- We use a deterministic finite automaton to have O(n) runtime.\n- We run the Common Lisp compiler to generate machine code, rather\n  than interpreting a DFA or bytecode, or jumping through closures\n  (like CL-PPCRE does).\n- We generate specialised code for each array type, so everything is\n  inlined.\n- If you use the `one-more-re-nightmare-simd` system on SBCL 2.1.10 or\n  newer with AVX2, we even use vectorised scanning of constant\n  prefixes of regular expressions.\n\nThanks to Gilbert Baumann for suggesting I use derivatives to compile\nregular expressions, and then for informing me of how to handle\nsubmatching properly, and my discrete mathematics teachers for\nformally introducing me to finite state machines.\n\nPlease see [the reference\nbook](https://applied-langua.ge/projects/one-more-re-nightmare/) for\nhow to use one-more-re-nightmare, or [an\narticle](https://applied-langua.ge/posts/omrn-compiler.html) on the\nhistory and theory involved.\n\nWhile the syntax is admittedly wonky (but somewhat more like how\nregular expressions are presented in papers), one-more-re-nightmare\nmakes its best effort to implement POSIX semantics for matching (as\ndescribed in the specification for [how `regcomp`\nworks](https://pubs.opengroup.org/onlinepubs/9699919799/functions/regexec.html)\nand [regular expression\ndefinitions](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html)). Any\nbehaviour contrary to POSIX is a bug.\n\n## A lousy benchmark\n\n```lisp\nCL-USER\u003e (let ((s (make-string 1000000 :initial-element #\\a)))\n           (setf (aref s 333333) #\\b)\n           (setf (aref s 555555) #\\c)\n           (the-cost-of-nothing:bench\n            (all-string-matches \"ab|ac\" s)))\n\nCL-USER\u003e (let ((s (make-string 1000000 :initial-element #\\a)))\n           (setf (aref s 333333) #\\b)\n           (setf (aref s 555555) #\\c)\n           (the-cost-of-nothing:bench\n            (cl-ppcre:all-matches-as-strings \"ab|ac\" s)))\n```\n\nNote that, by nature of calling the Common Lisp compiler,\none-more-re-nightmare will take longer to compile a regular\nexpression, so it is better suited for many matching operations with\nfew expressions. It does cache compiled expressions when using the\nhigh-level interface, so the initial cost may amortize well over many\ncalls; and constant regular expression strings are compiled at\ncompile-time, with no runtime overhead whatsoever.\n\n| engine           | SBCL      | Clozure CL | SBCL with AVX2 | ditto, SIMPLE-BASE-STRING |\n|------------------|-----------|------------|----------------|---------------------------|\n| o-m-r-n          | 0.57ms    | 2.93ms     | 0.18ms         | 55µs                      |\n| compilation time | 4.65ms    | 3.76ms     | 6.82ms         | 6.43ms                    |\n| cl-ppcre         | 22.8ms    | 45.3ms     | 22.8ms         | 21.6ms                    |\n| break even after | 209kchars | 88.7kchars | 301kchars      | 305kchars                 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelekons%2Fone-more-re-nightmare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelekons%2Fone-more-re-nightmare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelekons%2Fone-more-re-nightmare/lists"}