← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #176960]: How to check whether a string contains character/number/special character? --- use regular expressions (modul re)

 

Question #176960 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/176960

    Status: Open => Answered

RaiMan proposed the following answer:
basic, quick and dirty:

import re
test_char = re.compile('.*?[a-zA-Z]+')
test_num = re.compile('.*?[0-9]+')
test_other = re.compile('.*?[^a-zA-Z0-9]+')

if (re.match(test_num,p) and re.match(test_char,p) and re.match(test_other,p)): print "ok"
else: print "error"

Assures, that at least one character, one digit and one special
character is in the password.

If you want more, you have to dive into the reg-ex "science" at the
above mentioned general info site or read a book ;-)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.