diff --git a/src/common/config.py b/src/common/config.py index 23b997d47af3dab4e3e5f35a567055b15511afed..3457992b5058a3c88cda53c39d3be6d3250c9e43 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -19,7 +19,7 @@ ## -import sre +import re import copy import defs @@ -441,7 +441,7 @@ class Config: elif type[0] == 'string': return self.is_valid_string(val) else: - if sre.match(type[1], val): + if re.match(type[1], val): return val else: return None diff --git a/src/common/helpers.py b/src/common/helpers.py index 5dc224ff26529f9ef44223c785abadce4d708e69..7961cdfb30b3e02f4b02fbcafcea826e58988957 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -16,7 +16,7 @@ ## GNU General Public License for more details. ## -import sre +import re import locale import os import subprocess @@ -328,7 +328,7 @@ def from_one_line(msg): # to match the regexp that follows it # So here match '\\n' but not if you have a '\' before that - re = sre.compile(r'(?<!\\)\\n') + re = re.compile(r'(?<!\\)\\n') msg = re.sub('\n', msg) msg = msg.replace('\\\\', '\\') # s12 = 'test\\ntest\\\\ntest' diff --git a/src/common/nslookup.py b/src/common/nslookup.py index d6a0bd44dd865fed68ac78cf8123c5ebab29e250..484dc7f1dda80a09bab238e1efd0d7ed9e565a90 100644 --- a/src/common/nslookup.py +++ b/src/common/nslookup.py @@ -14,7 +14,7 @@ import sys import os -import sre +import re from xmpp.idlequeue import * @@ -24,10 +24,10 @@ elif os.name == 'posix': import fcntl # it is good to check validity of arguments, when calling system commands -ns_type_pattern = sre.compile('^[a-z]+$') +ns_type_pattern = re.compile('^[a-z]+$') # match srv host_name -host_pattern = sre.compile('^[a-z0-9\-._]*[a-z0-9]\.[a-z]{2,}$') +host_pattern = re.compile('^[a-z0-9\-._]*[a-z0-9]\.[a-z]{2,}$') class Resolver: def __init__(self, idlequeue): diff --git a/src/gajim.py b/src/gajim.py index a2e66fd5e437736806c587c20632a4fa0d379562..a26c17a7e7bccc26b36295f9784d4a98174fc1b0 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -96,7 +96,7 @@ del path import gobject -import sre +import re import signal import getopt import time @@ -1573,7 +1573,7 @@ class Interface: basic_pattern = links + mail if gajim.config.get('ascii_formatting'): basic_pattern += formatting - self.basic_pattern_re = sre.compile(basic_pattern, sre.IGNORECASE) + self.basic_pattern_re = re.compile(basic_pattern, re.IGNORECASE) emoticons_pattern = '' if gajim.config.get('emoticons_theme'): @@ -1587,7 +1587,7 @@ class Interface: emoticons_pattern_postmatch = '' emoticon_length = 0 for emoticon in keys: # travel thru emoticons list - emoticon_escaped = sre.escape(emoticon) # espace regexp metachars + emoticon_escaped = re.escape(emoticon) # espace regexp metachars emoticons_pattern += emoticon_escaped + '|'# | means or in regexp if (emoticon_length != len(emoticon)): # Build up expressions to match emoticons next to other emoticons @@ -1607,12 +1607,12 @@ class Interface: # because emoticons match later (in the string) they need to be after # basic matches that may occur earlier emot_and_basic_pattern = basic_pattern + emoticons_pattern - self.emot_and_basic_re = sre.compile(emot_and_basic_pattern, sre.IGNORECASE) + self.emot_and_basic_re = re.compile(emot_and_basic_pattern, re.IGNORECASE) # at least one character in 3 parts (before @, after @, after .) - self.sth_at_sth_dot_sth_re = sre.compile(r'\S+@\S+\.\S*[^\s)?]') + self.sth_at_sth_dot_sth_re = re.compile(r'\S+@\S+\.\S*[^\s)?]') - sre.purge() # clear the regular expression cache + re.purge() # clear the regular expression cache def on_emoticon_sort(self, emot1, emot2): len1 = len(emot1)