regex and check for compliance and attacks improved