{"id":13726250,"url":"https://github.com/ocaml/ocaml-re","last_synced_at":"2025-04-08T10:14:37.012Z","repository":{"id":2161685,"uuid":"3107468","full_name":"ocaml/ocaml-re","owner":"ocaml","description":"Pure OCaml regular expressions, with support for Perl and POSIX-style strings","archived":false,"fork":false,"pushed_at":"2025-03-30T09:55:50.000Z","size":2100,"stargazers_count":236,"open_issues_count":22,"forks_count":62,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-01T09:27:51.356Z","etag":null,"topics":["dfa","ocaml","regular-expression"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ocaml.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2012-01-05T03:14:49.000Z","updated_at":"2025-03-30T09:55:55.000Z","dependencies_parsed_at":"2024-02-01T20:07:51.044Z","dependency_job_id":"faa71d11-41e7-4363-a78c-e1e67db1ffc0","html_url":"https://github.com/ocaml/ocaml-re","commit_stats":{"total_commits":446,"total_committers":46,"mean_commits":9.695652173913043,"dds":0.5807174887892377,"last_synced_commit":"6b889974dfdc3b0dc5ddf0ad670e1cc9dc974c2a"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Focaml-re","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Focaml-re/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Focaml-re/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Focaml-re/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ocaml","download_url":"https://codeload.github.com/ocaml/ocaml-re/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247819933,"owners_count":21001394,"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":["dfa","ocaml","regular-expression"],"created_at":"2024-08-03T01:02:56.878Z","updated_at":"2025-04-08T10:14:36.994Z","avatar_url":"https://github.com/ocaml.png","language":"OCaml","funding_links":[],"categories":["OCaml","Regular Expressions","\u003ca name=\"OCaml\"\u003e\u003c/a\u003eOCaml"],"sub_categories":[],"readme":"Description\n===========\n\nRe is a regular expression library for OCaml.\n[![Build status](https://github.com/ocaml/ocaml-re/actions/workflows/main.yml/badge.svg)](https://github.com/ocaml/ocaml-re/actions/workflows/main.yml)\n\nContact\n=======\n\nThis library has been written by Jerome Vouillon\n(Jerome.Vouillon@pps.univ-paris-diderot.fr).\nIt can be downloaded from \u003chttps://github.com/ocaml/ocaml-re\u003e\n\nBug reports, suggestions and contributions are welcome.\n\nFeatures\n========\n\nThe following styles of regular expressions are supported:\n- Perl-style regular expressions (module `Re.Perl`);\n- Posix extended regular expressions (module `Re.Posix`);\n- Emacs-style regular expressions (module `Re.Emacs`);\n- Shell-style file globbing (module `Re.Glob`).\n\nIt is also possible to build regular expressions by combining simpler regular\nexpressions (module `Re`).\n\nThe most notable missing features are **back-references** and\nlook-ahead/look-behind **assertions**.\n\nThere is also a subset of the PCRE interface available in the `Re.Pcre` module.\nThis makes it easier to port code from that library to Re with minimal changes.\n\nPerformances\n============\n\nThe matches are performed by lazily building a DFA (deterministic\nfinite automaton) from the regular expression. As a consequence,\nmatching takes linear time in the length of the matched string.\n\nThe compilation of patterns is slower than with libraries using\nback-tracking, such as PCRE.  But, once a large enough part of the\nDFA is built, matching is extremely fast.\n\nOf course, for some combinations of regular expression and string, the\npart of the DFA that needs to be build is so large that this point is\nnever reached, and matching will be slow.  This is not expected to\nhappen often in practice, and actually a lot of expressions that\nbehaves badly with a backtracking implementation are very efficient\nwith this implementation.\n\nThe library is at the moment entirely written in OCaml.  As a\nconsequence, regular expression matching is much slower when the\nlibrary is compiled to bytecode than when it is compiled to native\ncode.\n\nHere are some timing results (Pentium III 500Mhz):\n* Scanning a 1Mb string containing only `a`s, except for the last\n  character which is a `b`, searching for the pattern `aa?b`\n  (repeated 100 times):\n    - RE: 2.6s\n    - PCRE: 68s\n* Regular expression example from http://www.bagley.org/~doug/shootout/ [1]\n    - RE: 0.43s\n    - PCRE: 3.68s\n\n  [1] this page is no longer up but is available via the Internet Archive \n  http://web.archive.org/web/20010429190941/http://www.bagley.org/~doug/shootout/bench/regexmatch/\n\n* The large regular expression (about 2000 characters long) that\n  Unison uses with my preference file to decide whether a file should\n  be ignored or not.  This expression is matched against a filename\n  about 20000 times.\n    - RE: 0.31s\n    - PCRE: 3.7s\n  However, RE is only faster than PCRE when there are more than about\n  300 filenames.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focaml%2Focaml-re","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focaml%2Focaml-re","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focaml%2Focaml-re/lists"}