I am trying to make more use of regEx in my search engine. Please take a look :
someStr = "Processor AMD Athlon II X4 651K BOX Black Edition, s. FM1, 3.0GHz, 4MB cache, Quad Core"
# THIS SHOULD MATCH / processors-plural with 0 to 1,
# mega or mb should be the same
# and quad with 0 to 2 of any characters except whitespace
queryListTrue = ["processors", "amd", "4mega", "quaddy"]
# THIS SHOULDN'T MATCH / bad last item length
queryListFalse = ["processors", "amd", "4mb", "quaddie"]
# TO DESCRIBE WHAT I NEED
rulesList = [ r'processor[i.e. 0-1 char]', r'amd',
r'4mega or 4mb', r'quad[from 0 to 2 any char]' ]
if ALL queryListTrue MATCHES someStr THRU rulesList :
print "What a wonderful world!"
Any help would be wonderful.