semvec/pypi-packages huggingface dataset:
brrs2 2.0.11
der3
Requires Python: >=3.6, <4
Keywords: sample,setuptools,development

<p>
<a href="https://gcsd.instructure.com/courses/14876/pages/tiktok-fans-hack-get-100k-free-tiktok-fans-very-easy">https://gcsd.instructure.com/courses/14876/pages/tiktok-fans-hack-get-100k-free-tiktok-fans-very-easy</a><br />
<a href="https://gcsd.instructure.com/courses/14876/pages/tiktok-followers-hack-get-999k-free-tiktok-fans-and-likes-very-easy">https://gcsd.instructure.com/courses/14876/pages/tiktok-followers-hack-get-999k-free-tiktok-fans-and-likes-very-easy</a><br />
<a href="https://gcsd.instructure.com/courses/14876/pages/rbg-free-tiktok-fans-generato-89">https://gcsd.instructure.com/courses/14876/pages/rbg-free-tiktok-fans-generato-89</a><br />
<a href="https://gcsd.instructure.com/courses/14876/pages/free-robux-2021-very-very-fast">https://gcsd.instructure.com/courses/14876/pages/free-robux-2021-very-very-fast</a><br />
<a href="https://gcsd.instructure.com/courses/14876/pages/free-robux-2021-free-robux-easy">https://gcsd.instructure.com/courses/14876/pages/free-robux-2021-free-robux-easy</a><br />
<a href="https://gcsd.instructure.com/courses/14876/pages/robux-hack-get-750$-free-robux-generator-very-easy">https://gcsd.instructure.com/courses/14876/pages/robux-hack-get-750$-free-robux-generator-very-easy</a><br />
<a href="https://gcsd.instructure.com/courses/11489/pages/garena-free-fire-hack-very-very-easy">https://gcsd.instructure.com/courses/11489/pages/garena-free-fire-hack-very-very-easy</a><br />
<a href="https://gcsd.instructure.com/courses/11489/pages/free-fire-hack-app-tool-easy">https://gcsd.instructure.com/courses/11489/pages/free-fire-hack-app-tool-easy</a><br />
<a href="https://gcsd.instructure.com/courses/11489/pages/garena-free-fire-hack-get-999k-free-fire-hack-very-easy">https://gcsd.instructure.com/courses/11489/pages/garena-free-fire-hack-get-999k-free-fire-hack-very-easy</a><br />
<a href="https://gcsd.instructure.com/courses/11489/pages/100-percent-working-garena-free-fire-hack-diamonds-2021-fd6-no-verification-very-easy">https://gcsd.instructure.com/courses/11489/pages/100-percent-working-garena-free-fire-hack-diamonds-2021-fd6-no-verification-very-easy</a><br />
<a href="https://gcsd.instructure.com/courses/11489/pages/100-percent-working-garena-free-fire-hack-diamonds-2021-fd6-no-verification-i8">https://gcsd.instructure.com/courses/11489/pages/100-percent-working-garena-free-fire-hack-diamonds-2021-fd6-no-verification-i8</a>
</p>
RegexFactory 0.0.0
Dynamically generate regex patterns

# RegexFactory

Dynamically construct python regex patterns.

## Examples

### Matching Initials
Say you want a regex pattern to match the initials of someones name.

```python
import re
from regexfactory import Amount, Range


pattern = Amount(Range("A", "Z"), 2, 3)

matches = re.findall(
    str(pattern),
    "My initials are BDP. Valorie's are VO"
)

print(matches)
```

```
['BDP', 'VO']
```

### Matching Hex Strings

Or how matching both uppercase and lowercase hex strings in a sentence.

```python
import re
from regexfactory import *

pattern = Optional("#") + Or(
    Amount(
        Set(
            Range("0", "9"),
            Range("a", "f")
        ),
        6
    ),
    Amount(
        Set(
            Range("0", "9"),
            Range("A", "F")
        ),
        6
    ),
    
)

sentence = """
My favorite color is #000000. I also like 5fb8a0. My second favorite color is #FF21FF.
"""

matches = re.findall(
    str(pattern),
    sentence
)
print(matches)
```

```
['#000000', '5fb8a0', '#FF21FF']
```

### Matching URLs

Or what if you want to match urls in html content?

```python
from regexfactory import *
import re


protocol = Amount(Range("a", "z"), 1, ormore=True)
host = Amount(Set(WORD, DIGIT, '.'), 1, ormore=True)
port = Optional(Group(RegexPattern(":") + Amount(DIGIT, 1, ormore=True)))
path = Amount(Group(RegexPattern('/') + Group(Amount(NotSet('/', '#', '?', '&', WHITESPACE), 0, ormore=True))), 0, ormore=True)
patt = protocol + RegexPattern("://") + host + port + path



sentence = "This is a cool url, https://github.com/GrandMoff100/RegexFactory/ "
print(patt)

print(re.search(str(patt), sentence))
```

```
[a-z]{1,}://[\w\d.]{1,}(:\d{1,})?(/([^/#?&\s]{0,})){0,}
<re.Match object; span=(15, 51), match='https://github.com/GrandMoff100/RegexFactory/'>
```

## The Pitch

This library is really good at allowing you to intuitively understand how to construct a regex expression.
It helps you identify what exactly your regular expression is, and can help you debug it.
This is library is also very helpful for generating regex expressions on the fly if you find use for it.
You can also extend this library by subclassing `RegexPattern` and add your own support for different regex flavors.

There you have it. This library is intuitive, extensible, modular, and dynamic.
Why not use it?