add testcode for iwlist
[dumbwifi.git] / regex.py
blob011b528ef87e500c99fa8e1f60985c0ae068c78a
1 import re
4 # String matching
6 def matches(r, s):
7 m = re.compile(r).search(s)
8 if m: return True
10 def find1(r, s):
11 m = re.compile(r).search(s)
12 if m and m.groups() and m.groups()[0]:
13 return m.groups()[0]
15 def find(r, s):
16 m = re.compile(r).search(s)
17 if m: return m
18 #return m.groups()
20 def findall(r, s):
21 m = re.compile(r).findall(s)
22 if m: return m
24 def replaceall(old, new, s):
25 return re.sub(old, new, s)