<commit_before>libre
=====

##### libre is a tiny regular expression library for C

libre compiles regular expressions into NFAs for reasonably
fast matching speeds. Its interface is very simple. It exposes
three functions, all of which are self-explanatory.

```c
re_pat *re_compile(char const *)

bool re_match(re_pat const *, char const *)

void re_free(re_pat *)
```

To use libre, simply clone this repository and run `make && sudo make install`.


###### Here is a small example of libre being used

```
#include <re.h>
#include <stdio.h>
#include <assert.h>

int main(void)
{
        re_pat *p = re_compile("(https?://)?www.google.(ca|com)");
        if (p == NULL) {
                fputs("Failed to compile regular expression.\n", stderr);
                return 1;
        }

        assert(re_match(p, "https://www.google.ca"));
        assert(re_match(p, "http://www.google.ca"));
        assert(re_match(p, "https://www.google.com"));
        assert(re_match(p, "https://www.google.com"));<commit_msg>improve readme a bit<commit_after>libre
=====

#### libre is a tiny regular expression library for C

libre compiles regular expressions into NFAs for reasonably
fast matching speeds. Its interface is very simple; it exposes
three functions, all of which are self-explanatory.

```c
re_pat *re_compile(char const *)

bool re_match(re_pat const *, char const *)

void re_free(re_pat *)
```

#### Usage

To use libre, simply clone this repository and run `make && sudo make install`.


#### Example

```c
#include <re.h>
#include <stdio.h>
#include <assert.h>

int main(void)
{
        re_pat *p = re_compile("(https?://)?www.google.(ca|com)");
        if (p == NULL) {
                fputs("Failed to compile regular expression.\n", stderr);
                return 1;
        }

        assert(re_match(p, "https://www.google.ca"));
        assert(re_match(p, "http://www.google.ca"));
        assert(re_match(p, "https://www.google.com"));
        assert(re_match(p, "https://www.google.com"));
{'fraction_non_alphanumeric': 0.15181682429069188, 'fraction_numerical': 0.0009955201592832255, 'mean_word_length': 3.1875, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2902783', 'n_tokens_mistral': 653, 'n_tokens_neox': 628, 'n_words': 192}