Question: I'm doing this exercise on codeacademy.com, and I stumbled on this exercise that doesn't really make any sense. It gave out an error when I tried to include the hashtag in the first[]. I'm not sure why.

```
//change the regexp to have only good message

var emailregexp = /[a-z0-9._%+-#]+@[a-z0-9.-]+\.[a-z]{2,4}/;
console.log(emailregexp.test("michael.courcy@microsoft.com")?"good":"bad");
console.log(emailregexp.test("michael.courcy@gmail.com")?"good":"bad");
console.log(emailregexp.test("###mic###@microsoft.com")?"good":"bad");

```

 **output** 

```
error

```

Answer: 
Because `#` doesn’t come after `+` in the Unicode table.

`+-#` inside square brackets is a *range* (from `+` to `#`). If you want the dash to be a separate character, use `\-` or move it to the end of the bracket: `+#-]`.
The error is this:

> 
> SyntaxError: Invalid regular expression:
>  /[a-z0-9.\_%+-#]+@[a-z0-9.-]+.[a-z]{2,4}/: Range out of order in
>  character class
> 
> 
> 

The issue is the **-** (dash) that is before the **#**. JavaScript is trying to define a range which includes all characters between **+** (plus) and **#**, which is invalid.

Swap the **-** and **#** like so:

```
var emailregexp = /^[a-z0-9._%+-#]+@[a-z0-9\.-]+\.[a-z]{2,4}$/i;

```

Also note the caret anchor at the beginning and the **$** at the end. This indicates that the content must match from beginning to end, without the **^** and **$** any string that contains an email address will match.

You may want the **i** flag to allow uppercase letters.