Question: I want to replace all whitespace characters in a string with a "+" and all "ß" with "ss"... it works well for "ß", but somehow eclipse won't let me use \s for a whitespace.. I tried "\t" instead, but it doesn't work either.. I get the following error:

> 
> Invalid escape sequence (valid ones
>  are \b \t \n \f \r \" \' \ )
> 
> 
> 

this is my code:

```
try {
    String temp1 = from.getText().toString();
    start_from  = temp1.replaceAll("ß", "ss");
    start_from  = start_from.replaceAll("\s", "+");
}

```

why doesn't it work? is it a problem with android, eclipse or what?

thanks in advance!

Answer: 
You need to escape the slash

```
start_from  = start_from.replaceAll("\\s", "+");

```
You can use the java.util.regex.Pattern class and use something like `p = Pattern.compile("\s");` in combination with `p.matcher(start_from).replaceAll("+")`. Alternatively, just escape your "\s" metacharacter as "\\s".