
November 3rd, 2003, 12:49 AM
|
|
Contributing User
|
|
Join Date: Mar 2003
Posts: 325
Time spent in forums: 7 h 58 m 36 sec
Reputation Power: 11
|
|
|
import re
str1 = "this is crazy"
str2 = "thiis is crazy"
if re.search('i{2,}',str1) is not None: print "first"
if re.search('i{2,}',str2) is not None: print "second"
the '{a,b}' specifies it is looking for between a and b occurences of it. If you leave out the b, it looks for minimum of a occurneces. Similarly with leaving out the a
|