Changed variable to %variable-name, improved if match to accept !statement and abstracted string and variable detection.