Made regex more specific. Added states list to check JS regex against. Moved JS to just before the body tag to be safe.