Update index.php

Regex to handle when whites spaces, trailing semicolon are present in the input.