{"id":25933317,"url":"https://github.com/anrl/librx","last_synced_at":"2025-06-15T14:38:31.945Z","repository":{"id":146396010,"uuid":"124450817","full_name":"anrl/librx","owner":"anrl","description":"Regex library inspired by Thompson NFAs, Perl 6, and PCRE","archived":false,"fork":false,"pushed_at":"2012-10-14T18:57:53.000Z","size":284,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T00:53:24.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"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/anrl.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}},"created_at":"2018-03-08T21:35:15.000Z","updated_at":"2019-10-09T06:29:51.000Z","dependencies_parsed_at":"2023-03-24T00:59:39.763Z","dependency_job_id":null,"html_url":"https://github.com/anrl/librx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anrl/librx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrl%2Flibrx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrl%2Flibrx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrl%2Flibrx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrl%2Flibrx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anrl","download_url":"https://codeload.github.com/anrl/librx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrl%2Flibrx/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259991082,"owners_count":22942557,"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":"2025-03-04T00:53:25.990Z","updated_at":"2025-06-15T14:38:31.907Z","avatar_url":"https://github.com/anrl.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n====\n\nlibrx - Regex library inspired by Thompson NFAs, Perl 6, and PCRE\n\nSYNOPSIS\n========\n\n    #include \u003crx.h\u003e\n    \n    int main {\n        Rx *rx = rx_new(\n            \"([chapter|page|line] - \u003cdigit\u003e+) [',' \\\\s* \u003c~~0\u003e] ** 1..2\"\n        );\n        if (rx_match(rx, \"chapter-55, page-44, line-33\"))\n            printf(\"it matches!\\n\");\n        rx_free(rx);\n    }\n\nDESCRIPTION\n===========\n\nThis regular expression library is based on a Thompson NFA rather than a\nbacktracking NFA. I originally read about Thompson's NFA in Russ Cox's article,\n[\"Regular Expression Matching Can Be Simple And Fast\"][rsc]. It also uses some\nsyntactic features found in Perl 6 [Synopse 05][s5].\n\n[rsc]: http://swtch.com/~rsc/regexp/regexp1.html\n[s5]: http://perlcabal.org/syn/S05.html\n\nDuring a match all possible paths are explored until there are no paths left or\nno characters left in the string.\n\nFUNCTIONS\n=========\n\n-   ``Rx *rx_new(const char *rx_str)``\n\n    Allocate a new Rx object from a string containing the regular expression.\n\n-   ``int rx_match(Rx *rx, const char *str)``\n\n    Match the regex against a string. Returns whether it matched. Eventually\n    this should fill in a match object which will allow one to find out what\n    matched and the groups that matched in it.\n\n-   ``void rx_free(Rx *rx)``\n\n    Frees the memory of a regex previously created by rx_new().\n\n-   ``int rx_debug``\n\n    You may set this global variable to cause rx_new() to print out a\n    representation of the regex to stdout and rx_match() will print out its\n    list of paths and matches after each character of the string is read.\n\nSYNTAX\n======\n\nMany regex features that one may expect are supported.\n\nAn alphanumeric character, ``_``, or ``-`` will match itself. All other\ncharacters need to be escaped with a backslash or enclosed in quotes or\ncharacter classes.\n\nNote that in C, double quoted strings interpolate escapes, so you have to\nescape all backslashes before sending them to rx_new().\n\nYou may quote a string of characters with single (``'``) or double (``\"``)\nquotes and its contents will match unaltered. There is no difference between\nsingle and double quotes except double quotes allow for escapes. For example,\n``'*runs away*'`` will match the string ``\"*runs away*\"``.\n\nAll whitespace is insignificant except in quoted forms.\n\nA ``|`` separates alternate matches.\n\nEach atom may have a quantifier after it.\n\n-   ``*`` matches 0 or more times\n-   ``+`` matches 1 or more times\n-   ``?`` matches 0 or 1 times\n-   ``** n`` matches n times\n-   ``** n..m`` matches at least n times and at most m times\n-   ``** n..*`` matches n or more times\n\nYou may group a portion of the regex in parentheses ``(`` which may be used as\nany other atom and referenced later either with ``\u003c~~#\u003e`` or through the Match\nobject. There is also the ability to group without capturing with square\nbrackets ``[``.\n\nAn extensible meta-syntax of the form ``\u003c...\u003e`` has been added to implement\nspecial features much like the Perl 5 construct of ``(?...)``.\n\nYou can refer to the pattern in previous groups by referencing them as a number\nin the extensible meta syntax. ``/(cool)\u003c~~0\u003e/``. These can even refer to its\nown group recursively. You can refer to the whole pattern by using ``\u003c~~\u003e``.\n\nThe ``.`` character really matches any character. If you want everything but a\nnewline, use ``\\N``. Also, there are escapes ``\\T`` and ``\\R`` for anything but\n``\\t`` and ``\\r``.\n\nEscaped character classes ``\\w`` matches a word char, ``\\s`` matches a space\nchar, and ``\\d`` matches a digit. They may be negated with ``\\W``, ``\\S``, and\n``\\D`` which will match anything but what their lower case version would match.\n\nA character class is specified with ``\u003c[...]\u003e``. For example, ``\u003c[a..z_]\u003e``,\nspecifies any character from ``a`` to ``z`` or ``_``. Whitespace is ignored in\nthis construct, and you can combine character classes by adding and subtracting\nthem like this ``\u003c[a..z] + ['] - [m..q]\u003e``. Negated character classes start\nwith a ``-``, so ``\u003c-[aeiou]\u003e`` matches anything but a vowel.\n\nThe following named character classes are allowed as well: upper, lower, alpha,\ndigit, xdigit, print, graph, cntrl, punct, alnum, space, blank, and word. They\nmay be combined with ``+`` and ``-`` just as the bracketed char classes can.\n``\u003c[_] + alpha + punct\u003e`` or used on their own like ``\u003cprint\u003e``.\n\nAssertions ``^`` matches the beginning of the string, ``^^`` matches the\nbeginning of a line, ``$`` matches the end of the string, ``$$`` matches the\nend of a line, ``\u003c\u003c`` matches a left word boundary, ``\u003e\u003e`` matches a right word\nboundary, ``\\b`` matches a word boundary regardless of being on the left or\nright side, and ``\\B`` matches a non-word boundary.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanrl%2Flibrx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanrl%2Flibrx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanrl%2Flibrx/lists"}