<commit_before># crocs

Write regex using pure python class/function syntax and test it better.

The idea behind crocs is simplifying the construction and debugging of regex's. 
It is possible to implement regex's using a function/class syntax, the resulting structure 
is then compiled into a regex's string. it is as well possible to generate random inputs 
for the regex that would match the regex pattern.

It is also possible to insert a raw regex string and generate possible matches. It helps a lot
when debugging regex's. 

The project relies on [eacc](https://github.com/iogf/eacc) to build an AST for the given regex.

~~~
[tau@archlinux eacc.wiki-code]$ regxhits 
Regstr:ab*c.f
Regex: ab{0,}c.f
Input: ababababababc}f
Group dict: {}
Group 0: abc}f
Groups: ()
Match with:
 abababc3f abc3f ababababababababc%f abababababababcUf 
ababababababababababcTf abababababc(f abcmf ababababababababababcDf 
abcDf ababababc'f

~~~

A more complicated example.

~~~
eacc.eacc.EaccError: Unexpected struct!
[tau@archlinux ~]$ regxhits 
Regstr:a(b.?c)m.n?
Regex: a(b.\?c)m.n\?
Input: abP?cm|n?
Group dict: {}
Group 0: abP?cm|n?
Groups: ('bP?c',)
Match with:
 abP?cm\n? abP?cmPn? abP?cmrn? abP?cm`n? abP?cmun? 
abP?cmdn? abP?cmtn? abP?cm1n? abP?cm:n? abP?cmIn?
~~~

The examples below clarifies better.

### Wildcard

~~~python
from crocs.regex import Join, X

e = Join('a', X(), 'b')
e.test()
e.hits()
~~~

The above code would give you the regex's string and also possible matches.

~~~
Regex: a.b
Input: aob<commit_msg>Updating.<commit_after># crocs

Write regex using pure python class/function syntax and test it better.

The idea behind crocs is simplifying the construction and debugging of regex's. 
It is possible to implement regex's using a function/class syntax, the resulting structure 
is then compiled into a regex's string. it is as well possible to generate random inputs 
for the regex that would match the regex pattern.

It is also possible to insert a raw regex string and generate possible matches. It helps a lot
when debugging regex's. 

The project relies on [eacc](https://github.com/iogf/eacc) to build an AST for the given regex.

~~~
[tau@archlinux eacc.wiki-code]$ regxhits 
Regstr:ab*c.f
Regex: ab{0,}c.f
Input: ababababababc}f
Group dict: {}
Group 0: abc}f
Groups: ()
Match with:
 abababc3f abc3f ababababababababc%f abababababababcUf 
ababababababababababcTf abababababc(f abcmf ababababababababababcDf 
abcDf ababababc'f

~~~

A more complicated example.

~~~
[tau@archlinux ~]$ regxhits 
Regstr:a(b.?c)m.n?
Regex: a(b.{0,1}c)m.n{0,1}
Input: abdcmin
Group dict: {}
Group 0: abdcmin
Groups: ('bdc',)
Match with:
 abdcm{n   abdcmcn abdcm5n abdcmHn   abdcmSn 

~~~

The examples below clarifies better.

### Wildcard

~~~python
from crocs.regex import Join, X

e = Join('a', X(), 'b')
e.test()
e.hits()
~~~

The above code would give you the regex's string and also possible matches.

~~~
Regex: a.b
Input: aob
{'fraction_non_alphanumeric': 0.10762942779291552, 'fraction_numerical': 0.005449591280653951, 'mean_word_length': 4.691860465116279, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '154551', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1078, 'n_words': 373}