Skip to content

Commit

Permalink
Fixed issue madisonmay#21 (case of empty strings)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush268 committed Mar 31, 2017
1 parent 4aef9a3 commit 225c603
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions commonregex.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,22 @@ def regex_method(text=None):
class CommonRegex(object):

def __init__(self, text=""):
self.text = text

if text:
self.text = text
else:
print('Input string is empty, Input New String and Try Again')
self.text = ' '

for k, v in regexes.items():
setattr(self, k, regex(self, v)(self))

if text:
for key in regexes.keys():
method = getattr(self, key)
setattr(self, key, method())
for key in regexes.keys():
method = getattr(self, key)
setattr(self, key, method())

def append(self, string = "" ):
self.text += ' ' + string

def __str__(self):
return self.text

0 comments on commit 225c603

Please sign in to comment.