Corrected regex--issues with curly braces--and updated program logic.