This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
import threading | |
class Listener(threading.Thread): | |
def __init__(self, r, channels): | |
threading.Thread.__init__(self) | |
self.redis = r | |
self.pubsub = self.redis.pubsub() | |
self.pubsub.subscribe(channels) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emailPattern = /// ^ #begin of line | |
([\w.-]+) #one or more letters, numbers, _ . or - | |
@ #followed by an @ sign | |
([\w.-]+) #then one or more letters, numbers, _ . or - | |
\. #followed by a period | |
([a-zA-Z.]{2,6}) #followed by 2 to 6 letters or periods | |
$ ///i #end of line and ignore case | |
if "[email protected]".match emailPattern | |
console.log "E-mail is valid" |
NewerOlder