fixed the regex for validation and fixed the flash alert close action