Question: I've come through a lot of articles and even questions on SO which state that that in PHP, because of the fact that regular expressions are represented using strings, you must escape all backslashes. But for some reason, the following returns true without failing:

```
preg_match('/^\w+\d+$/','abcdef123456')

```

How come it works if I'm supposed to escape the `\`s? It seems unnecessary, but then why does everyone say otherwise?

Answer: 
According to [PHP String - Manual - Single quoted](http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single):

> 
> To specify a literal single quote, escape it with a backslash (\). To
>  specify a literal backslash, double it (\\). **All other instances of
>  backslash will be treated as a literal backslash**: this means that the
>  other escape sequences you might be used to, such as \r or \n, will be
>  output literally as specified rather than having any special meaning.
> 
> 
>
Because you're using single quotes. In fact, with double quotes it doesn't matter here because `\w` has no special meaning in a PHP string and therefor is left as `\w`.