Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
venv
dist
build
*.py[co]
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
PythonVerbalExpressions
=======================

## Installation
```bash
python setup.py install
```

Hopefully you will also be able to use
```bash
pip install verbalexpressions
```
in the near future.

## Usage
```python
from verbalexpressions import VerEx
verbal_expression = VerEx()
```

## Developer setup : running the tests
```bash
python setup.py test
```
21 changes: 21 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python

from setuptools import setup

if __name__ == '__main__':
setup(
name = 'VerbalExpressions',
version = '0.0.1',
description = 'Make difficult regular expressions easy! Python port of the awesome VerbalExpressions repo - https://github.com/jehna/VerbalExpressions',
long_description = '''Please see https://github.com/VerbalExpressions/PythonVerbalExpressions/blob/master/README.md for more information!''',
author = "Mihai Ionut Vilcu, Peder Soholt",
author_email = "",
license = 'MIT',
url = 'https://github.com/VerbalExpressions/PythonVerbalExpressions',
test_suite='tests',
scripts = [],
packages = ['verbalexpressions'],
classifiers = [],
zip_safe=True
)

1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from verbal_expressions_test import *
6 changes: 3 additions & 3 deletions tests/verbal_expressions_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
import unittest
from verbal_expressions import VerEx
from verbalexpressions import VerEx
import re

class VerExTest(unittest.TestCase):
Expand Down Expand Up @@ -74,7 +74,7 @@ def test_line_break_false(self):

def test_tab_true(self):
self.exp = self.v.start_of_line().anything().tab().end_of_line().regex()
self.assertRegexpMatches('One tab only ', self.exp, 'No tab here!')
self.assertRegexpMatches('One tab only ', self.exp, 'No tab here!')

def test_tab_false(self):
self.exp = self.v.start_of_line().anything().tab().end_of_line().regex()
Expand Down Expand Up @@ -110,4 +110,4 @@ def test_email(self):

def test_url(self):
self.exp = self.v.start_of_line().then('http').maybe('s').then('://').maybe('www.').word().then('.').word().maybe('/').end_of_line().regex()
self.assertRegexpMatches('https://www.google.com/', self.exp, 'Not a valid email')
self.assertRegexpMatches('https://www.google.com/', self.exp, 'Not a valid email')
1 change: 1 addition & 0 deletions verbalexpressions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from verbal_expressions import VerEx, re_escape
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def __getattr__(self, attr):
regex = self.regex()
return getattr(regex, attr)

def __str__(self):
return self.s

def add(self, value):
self.s += value
return self
Expand Down