Difference between revisions of "Python: regex"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) (Created page with " def contains_alphanumeric( input): r=re.match('[0-9a-zA-Z]+', input) if r==None: return False else: return True") |
Onnowpurbo (talk | contribs) |
||
| Line 1: | Line 1: | ||
| − | def | + | ==Hanya a-zA-Z dalam string== |
| − | r=re.match('[ | + | |
| + | def hanya_huruf( input ): | ||
| + | r=re.match('^[a-zA-Z]+$', input) | ||
if r==None: | if r==None: | ||
return False | return False | ||
else: | else: | ||
return True | return True | ||
| + | |||
| + | ==Batas== | ||
| + | |||
| + | ^ start string | ||
| + | $ akhir string | ||
Latest revision as of 23:07, 31 January 2017
Hanya a-zA-Z dalam string
def hanya_huruf( input ):
r=re.match('^[a-zA-Z]+$', input)
if r==None:
return False
else:
return True
Batas
^ start string $ akhir string