check for regex result before length