Question: ```
mysql_query("insert into user_info(Name,Id,Password,Email,Gender,Date_of_birth) values('".$name."','".$iden."','".$pass1."','".$email."','".$gender."','STR_TO_DATE('$date','%d,%m,%Y')')");

```

Can anyone tell which part of this code is incorrect, as it is not entering anything in the database.....

Answer: 
```
validates_format_of :email, 
    :with => (/^([^@\s]+)@((gmail|yahoo|hotmail)\.+[a-z]{2,})$/i)

```

something like this?

[a-z] at the end won't capture something like '.com.au' or similar, is that okay?

Also,

```
. is for single character, you want \. for an actual period
otherwise 'gmailxcom' would be valid

```
To build upon the answer of @Neet324, you could use:

```
validates_format_of :email, :with => (/^([^@\s]+)@((\.?\w+)+)$/i)

```

to capture any email domains, including subdomains and country level top domains.