finally reindented the last copy paste. Listen up pythoners! 1) The tab character exists for a reason, use it! If you don't like how wide it is, change your editor, don't inflict it on the world. 2) Until everyone reads and understands number 1, Python will remain a joke.
added help and fixed linebreaks
added test with same string many times
store previously matched strings in a hash array to speed up subsequent lookups for the same string