STRling 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of STRling might be problematic. Click here for more details.
- strling-0.0.1/PKG-INFO +75 -0
- strling-0.0.1/README.md +70 -0
- strling-0.0.1/STRling/__init__.py +1 -0
- strling-0.0.1/STRling/lib.py +136 -0
- strling-0.0.1/STRling.egg-info/PKG-INFO +75 -0
- strling-0.0.1/STRling.egg-info/SOURCES.txt +8 -0
- strling-0.0.1/STRling.egg-info/dependency_links.txt +1 -0
- strling-0.0.1/STRling.egg-info/top_level.txt +1 -0
- strling-0.0.1/setup.cfg +4 -0
- strling-0.0.1/setup.py +20 -0
strling-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: STRling
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Description-Content-Type: text/markdown
|
|
5
|
+
|
|
6
|
+
# STRling
|
|
7
|
+
|
|
8
|
+
## The Next Generation of Regular Expressions
|
|
9
|
+
|
|
10
|
+
STRling is a powerful next-generation syntax designed as a user interface for writing regular expressions (RegEx) with an object-oriented approach. STRling is a simpler syntax than RegEx while maintaining the same underlying power and flexibility, making string validation more intuitive and less error-prone.
|
|
11
|
+
|
|
12
|
+
### Why STRling?
|
|
13
|
+
|
|
14
|
+
STRling recognizes the cryptic nature of RegEx can be challenging and susceptibility to errors. We provide a well-structured syntax that promotes readability and maintainability, empowering developers to focus on application logic rather than wrestling over difficult development tools. Most of all, we aim for a reliable product, which is why we only depend on built-in Python libraries.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### STRling's Mission
|
|
18
|
+
|
|
19
|
+
Our mission is to make RegEx a distant and outdated syntax by abstracting the complexities of RegEx into a clean, readable, and powerful interface. We strive to simplify string operations and ensure that developers can focus on building their applications without the steep learning curve of traditional RegEx. The previous alternative to RegEx was to learn the string validation syntax specific to each user input library, but STRling aims to unify the disparate syntaxes found across various libraries and frameworks into one simple library using only built-in Python packages.
|
|
20
|
+
|
|
21
|
+
### Key Features
|
|
22
|
+
|
|
23
|
+
- **High-Level Template Validation**: Quickly and easily validate common patterns using our template library.
|
|
24
|
+
- **Low-Level Pattern Construction**: Build complex regex patterns using a readable and maintainable, object-oriented syntax.
|
|
25
|
+
- **Escaping RegEx Jargon**: No longer write RegEx using complex jargon.
|
|
26
|
+
- **Dependencies**: Depends solely on built-in python libraries, fostering dependability and compatibility.
|
|
27
|
+
|
|
28
|
+
### Installation
|
|
29
|
+
|
|
30
|
+
Install STRling via pip:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pip install STRling
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Documentation - Developmental Guide
|
|
37
|
+
|
|
38
|
+
Here's a quick example to demonstrate how easy it is to get started with STRling:
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from STRling import match, group, lib, test
|
|
42
|
+
import re
|
|
43
|
+
|
|
44
|
+
# Define a group of 3 digits followed by a hyphen
|
|
45
|
+
num3hyp = group('group3', lib.num(3), lib.lit('-'))
|
|
46
|
+
|
|
47
|
+
# Define a group of 4 digits
|
|
48
|
+
num4 = group('group4', lib.num(4))
|
|
49
|
+
|
|
50
|
+
# Create a custom number group
|
|
51
|
+
custom = group('custom', num3hyp(2), num4())
|
|
52
|
+
|
|
53
|
+
# Define a group of 10 digits
|
|
54
|
+
num10 = group('group10', lib.num(10))
|
|
55
|
+
|
|
56
|
+
# Create a phone number group using either custom or num10
|
|
57
|
+
phone_number = group('phone_number', lib.or_(custom, num10))
|
|
58
|
+
|
|
59
|
+
# Compile the pattern and match against a string
|
|
60
|
+
compiled_pattern = re.compile(phone_number)
|
|
61
|
+
input_string = "123-456-7890"
|
|
62
|
+
match = compiled_pattern.match(input_string)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### License
|
|
66
|
+
|
|
67
|
+
STRling is licensed under the MIT License. See the [LICENSE](https://github.com/TheCyberLocal/STRling/blob/main/LICENSE) file for more information.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
Simplify your string validation and matching tasks with STRling, the all-in-one solution for developers who need powerful yet user-friendly tools for working with strings. Download and start using STRling today!
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
Feel free to adjust the links and other details as per your project specifics.
|
strling-0.0.1/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# STRling
|
|
2
|
+
|
|
3
|
+
## The Next Generation of Regular Expressions
|
|
4
|
+
|
|
5
|
+
STRling is a powerful next-generation syntax designed as a user interface for writing regular expressions (RegEx) with an object-oriented approach. STRling is a simpler syntax than RegEx while maintaining the same underlying power and flexibility, making string validation more intuitive and less error-prone.
|
|
6
|
+
|
|
7
|
+
### Why STRling?
|
|
8
|
+
|
|
9
|
+
STRling recognizes the cryptic nature of RegEx can be challenging and susceptibility to errors. We provide a well-structured syntax that promotes readability and maintainability, empowering developers to focus on application logic rather than wrestling over difficult development tools. Most of all, we aim for a reliable product, which is why we only depend on built-in Python libraries.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### STRling's Mission
|
|
13
|
+
|
|
14
|
+
Our mission is to make RegEx a distant and outdated syntax by abstracting the complexities of RegEx into a clean, readable, and powerful interface. We strive to simplify string operations and ensure that developers can focus on building their applications without the steep learning curve of traditional RegEx. The previous alternative to RegEx was to learn the string validation syntax specific to each user input library, but STRling aims to unify the disparate syntaxes found across various libraries and frameworks into one simple library using only built-in Python packages.
|
|
15
|
+
|
|
16
|
+
### Key Features
|
|
17
|
+
|
|
18
|
+
- **High-Level Template Validation**: Quickly and easily validate common patterns using our template library.
|
|
19
|
+
- **Low-Level Pattern Construction**: Build complex regex patterns using a readable and maintainable, object-oriented syntax.
|
|
20
|
+
- **Escaping RegEx Jargon**: No longer write RegEx using complex jargon.
|
|
21
|
+
- **Dependencies**: Depends solely on built-in python libraries, fostering dependability and compatibility.
|
|
22
|
+
|
|
23
|
+
### Installation
|
|
24
|
+
|
|
25
|
+
Install STRling via pip:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pip install STRling
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Documentation - Developmental Guide
|
|
32
|
+
|
|
33
|
+
Here's a quick example to demonstrate how easy it is to get started with STRling:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from STRling import match, group, lib, test
|
|
37
|
+
import re
|
|
38
|
+
|
|
39
|
+
# Define a group of 3 digits followed by a hyphen
|
|
40
|
+
num3hyp = group('group3', lib.num(3), lib.lit('-'))
|
|
41
|
+
|
|
42
|
+
# Define a group of 4 digits
|
|
43
|
+
num4 = group('group4', lib.num(4))
|
|
44
|
+
|
|
45
|
+
# Create a custom number group
|
|
46
|
+
custom = group('custom', num3hyp(2), num4())
|
|
47
|
+
|
|
48
|
+
# Define a group of 10 digits
|
|
49
|
+
num10 = group('group10', lib.num(10))
|
|
50
|
+
|
|
51
|
+
# Create a phone number group using either custom or num10
|
|
52
|
+
phone_number = group('phone_number', lib.or_(custom, num10))
|
|
53
|
+
|
|
54
|
+
# Compile the pattern and match against a string
|
|
55
|
+
compiled_pattern = re.compile(phone_number)
|
|
56
|
+
input_string = "123-456-7890"
|
|
57
|
+
match = compiled_pattern.match(input_string)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### License
|
|
61
|
+
|
|
62
|
+
STRling is licensed under the MIT License. See the [LICENSE](https://github.com/TheCyberLocal/STRling/blob/main/LICENSE) file for more information.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
Simplify your string validation and matching tasks with STRling, the all-in-one solution for developers who need powerful yet user-friendly tools for working with strings. Download and start using STRling today!
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
Feel free to adjust the links and other details as per your project specifics.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from . import lib
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# Decorators
|
|
5
|
+
def repetition(func):
|
|
6
|
+
def wrapper(*args, min=None, max=None, **kwargs):
|
|
7
|
+
pattern = func(*args, **kwargs)
|
|
8
|
+
pattern += repeat(min, max)
|
|
9
|
+
return pattern
|
|
10
|
+
return wrapper
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Range syntax
|
|
14
|
+
def repeat(min=None, max=None):
|
|
15
|
+
"""Create a range for the preceding symbol"""
|
|
16
|
+
if min is not None and max is not None:
|
|
17
|
+
if min > max:
|
|
18
|
+
raise ValueError('min cannot be greater than max')
|
|
19
|
+
return f'{{{min},{max}}}'
|
|
20
|
+
elif min is not None:
|
|
21
|
+
return f'{{{min}}}'
|
|
22
|
+
return ''
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Literals
|
|
26
|
+
@repetition
|
|
27
|
+
def lit(text):
|
|
28
|
+
"""Match the literal string `text`, optionally specifying repeat."""
|
|
29
|
+
return re.escape(text)
|
|
30
|
+
|
|
31
|
+
@repetition
|
|
32
|
+
def digit(min=None, max=None):
|
|
33
|
+
"""Match a digit, optionally specifying repeat."""
|
|
34
|
+
return r'\d'
|
|
35
|
+
|
|
36
|
+
@repetition
|
|
37
|
+
def letter(min=None, max=None):
|
|
38
|
+
"""Match a letter."""
|
|
39
|
+
return r'[A-Za-z]'
|
|
40
|
+
|
|
41
|
+
@repetition
|
|
42
|
+
def between(start_char, end_char):
|
|
43
|
+
"""Match any character between `start_char` and `end_char`."""
|
|
44
|
+
return f'[{start_char}-{end_char}]'
|
|
45
|
+
|
|
46
|
+
@repetition
|
|
47
|
+
def in_(chars):
|
|
48
|
+
"""Match any character in `chars`."""
|
|
49
|
+
return f'[{chars}]'
|
|
50
|
+
|
|
51
|
+
@repetition
|
|
52
|
+
def notin(chars):
|
|
53
|
+
"""Match any character not in `chars`."""
|
|
54
|
+
return f'[^{chars}]'
|
|
55
|
+
|
|
56
|
+
@repetition
|
|
57
|
+
def space():
|
|
58
|
+
"""Match a space."""
|
|
59
|
+
return r'\s'
|
|
60
|
+
|
|
61
|
+
@repetition
|
|
62
|
+
def any():
|
|
63
|
+
"""Match any character."""
|
|
64
|
+
return r'.'
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# Whitespace characters
|
|
68
|
+
@repetition
|
|
69
|
+
def newline():
|
|
70
|
+
"""Match a newline."""
|
|
71
|
+
return r'\n'
|
|
72
|
+
|
|
73
|
+
@repetition
|
|
74
|
+
def tab():
|
|
75
|
+
"""Match a tab."""
|
|
76
|
+
return r'\t'
|
|
77
|
+
|
|
78
|
+
@repetition
|
|
79
|
+
def carriage():
|
|
80
|
+
"""Match a carriage return."""
|
|
81
|
+
return r'\r'
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# Conditionals
|
|
85
|
+
def or_(*patterns):
|
|
86
|
+
"""Match any of the given patterns."""
|
|
87
|
+
joined = '|'.join(patterns)
|
|
88
|
+
return f'({joined})'
|
|
89
|
+
|
|
90
|
+
def may(pattern):
|
|
91
|
+
"""Match zero or one occurrence of the pattern."""
|
|
92
|
+
return f'{pattern}?'
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# Anchors
|
|
96
|
+
def start():
|
|
97
|
+
"""Match the start of the string."""
|
|
98
|
+
return r'^'
|
|
99
|
+
|
|
100
|
+
def end():
|
|
101
|
+
"""Match the end of the string."""
|
|
102
|
+
return r'$'
|
|
103
|
+
|
|
104
|
+
def bound(text):
|
|
105
|
+
"""Match the exact word `text`."""
|
|
106
|
+
return r'\b'
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# Lookarounds
|
|
110
|
+
def ahead(pattern):
|
|
111
|
+
"""Match if the pattern matches ahead."""
|
|
112
|
+
return f'(?={pattern})'
|
|
113
|
+
|
|
114
|
+
def behind(pattern):
|
|
115
|
+
"""Match if the pattern matches behind."""
|
|
116
|
+
return f'(?<={pattern})'
|
|
117
|
+
|
|
118
|
+
def notahead(pattern):
|
|
119
|
+
"""Match if the pattern does not match ahead."""
|
|
120
|
+
return f'(?!{pattern})'
|
|
121
|
+
|
|
122
|
+
def notbehind(pattern):
|
|
123
|
+
"""Match if the pattern does not match behind."""
|
|
124
|
+
return f'(?<!{pattern})'
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# Grouping
|
|
128
|
+
def group(name, *patterns):
|
|
129
|
+
"""Create a named capture group with the given patterns."""
|
|
130
|
+
joined = ''.join(patterns)
|
|
131
|
+
return f'(?P<{name}>{joined})'
|
|
132
|
+
|
|
133
|
+
def merge(*patterns):
|
|
134
|
+
"""Create a non-capturing group with the given patterns."""
|
|
135
|
+
joined = ''.join(patterns)
|
|
136
|
+
return f'(?:{joined})'
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: STRling
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Description-Content-Type: text/markdown
|
|
5
|
+
|
|
6
|
+
# STRling
|
|
7
|
+
|
|
8
|
+
## The Next Generation of Regular Expressions
|
|
9
|
+
|
|
10
|
+
STRling is a powerful next-generation syntax designed as a user interface for writing regular expressions (RegEx) with an object-oriented approach. STRling is a simpler syntax than RegEx while maintaining the same underlying power and flexibility, making string validation more intuitive and less error-prone.
|
|
11
|
+
|
|
12
|
+
### Why STRling?
|
|
13
|
+
|
|
14
|
+
STRling recognizes the cryptic nature of RegEx can be challenging and susceptibility to errors. We provide a well-structured syntax that promotes readability and maintainability, empowering developers to focus on application logic rather than wrestling over difficult development tools. Most of all, we aim for a reliable product, which is why we only depend on built-in Python libraries.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### STRling's Mission
|
|
18
|
+
|
|
19
|
+
Our mission is to make RegEx a distant and outdated syntax by abstracting the complexities of RegEx into a clean, readable, and powerful interface. We strive to simplify string operations and ensure that developers can focus on building their applications without the steep learning curve of traditional RegEx. The previous alternative to RegEx was to learn the string validation syntax specific to each user input library, but STRling aims to unify the disparate syntaxes found across various libraries and frameworks into one simple library using only built-in Python packages.
|
|
20
|
+
|
|
21
|
+
### Key Features
|
|
22
|
+
|
|
23
|
+
- **High-Level Template Validation**: Quickly and easily validate common patterns using our template library.
|
|
24
|
+
- **Low-Level Pattern Construction**: Build complex regex patterns using a readable and maintainable, object-oriented syntax.
|
|
25
|
+
- **Escaping RegEx Jargon**: No longer write RegEx using complex jargon.
|
|
26
|
+
- **Dependencies**: Depends solely on built-in python libraries, fostering dependability and compatibility.
|
|
27
|
+
|
|
28
|
+
### Installation
|
|
29
|
+
|
|
30
|
+
Install STRling via pip:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pip install STRling
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Documentation - Developmental Guide
|
|
37
|
+
|
|
38
|
+
Here's a quick example to demonstrate how easy it is to get started with STRling:
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from STRling import match, group, lib, test
|
|
42
|
+
import re
|
|
43
|
+
|
|
44
|
+
# Define a group of 3 digits followed by a hyphen
|
|
45
|
+
num3hyp = group('group3', lib.num(3), lib.lit('-'))
|
|
46
|
+
|
|
47
|
+
# Define a group of 4 digits
|
|
48
|
+
num4 = group('group4', lib.num(4))
|
|
49
|
+
|
|
50
|
+
# Create a custom number group
|
|
51
|
+
custom = group('custom', num3hyp(2), num4())
|
|
52
|
+
|
|
53
|
+
# Define a group of 10 digits
|
|
54
|
+
num10 = group('group10', lib.num(10))
|
|
55
|
+
|
|
56
|
+
# Create a phone number group using either custom or num10
|
|
57
|
+
phone_number = group('phone_number', lib.or_(custom, num10))
|
|
58
|
+
|
|
59
|
+
# Compile the pattern and match against a string
|
|
60
|
+
compiled_pattern = re.compile(phone_number)
|
|
61
|
+
input_string = "123-456-7890"
|
|
62
|
+
match = compiled_pattern.match(input_string)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### License
|
|
66
|
+
|
|
67
|
+
STRling is licensed under the MIT License. See the [LICENSE](https://github.com/TheCyberLocal/STRling/blob/main/LICENSE) file for more information.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
Simplify your string validation and matching tasks with STRling, the all-in-one solution for developers who need powerful yet user-friendly tools for working with strings. Download and start using STRling today!
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
Feel free to adjust the links and other details as per your project specifics.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
STRling
|
strling-0.0.1/setup.cfg
ADDED
strling-0.0.1/setup.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# pip install setuptools wheel twine
|
|
2
|
+
# python setup.py sdist bdist_wheel
|
|
3
|
+
# twine upload dist/*
|
|
4
|
+
from setuptools import setup, find_packages
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
with open('README.md', 'r') as f:
|
|
8
|
+
description = f.read()
|
|
9
|
+
|
|
10
|
+
setup(
|
|
11
|
+
name='STRling',
|
|
12
|
+
version='0.0.1',
|
|
13
|
+
packages=find_packages(),
|
|
14
|
+
install_requires=[
|
|
15
|
+
# Add dependencies here.
|
|
16
|
+
# e.g. 'numpy>=1.11.1'
|
|
17
|
+
],
|
|
18
|
+
long_description=description,
|
|
19
|
+
long_description_content_type='text/markdown',
|
|
20
|
+
)
|