Question: I am coming to this problem where I have a input field and inside my input field, I am checking if the user does not put any spaces and "@" symbol. However, I have wrote the code for checking for spaces, but having trouble to include the code for checking for "@" symbol. I tried using this: `&& value.contains("@")`, and change the `Object value` to `String value`, still did not work. Can any one show me how to check for "@" symbol prior to my code below. Thanks!

Here is my code:

```
            public void validate(FacesContext context, UIComponent component,
            Object value) throws ValidatorException {
        //Checking  if the user has typed only blank spaces and  "@" symbol. 

        //&& value.contains("@")
        if (value.toString().trim().isEmpty()) {
            FacesMessage msg
                    = new FacesMessage("Invalid input provided",
                            "Enter a valid address without @ Symbol and Spaces.");
            msg.setSeverity(FacesMessage.SEVERITY_ERROR);
            throw new ValidatorException(msg);

        }
    } 

```

Answer: 
Check

```
if (!value.toString().contains(" ") && !value.toString().contains("@"))

```
try this line :

```
 if(!value.toString().matches("[^a-z A-Z0-9]"))

```