Re: Why should I escape ]
- --- In firstname.lastname@example.org, "douglascrockford" <douglas@...> wrote:
>Changing the sequence to /[-\.\/]/g gives me "Unescaped '-'."
> The confusion is with the sequence -]. Does it mean
> JSLint is not smart enough to figure that out. Neither are most of us.
> So code it like you mean it.
This was the message I was looking for in the first place.
I have to escape the '-', not the ']'!
(The '-' can be used to create a set: /[a-z\.\/]/g will replace all characters a through z, the '.' and the '\' character).