Loading ...
Sorry, an error occurred while loading the content.

Re: Why should I escape ]

Expand Messages
  • woomla
    ... Changing the sequence to /[- . /]/g gives me Unescaped - . This was the message I was looking for in the first place. I have to escape the - , not the
    Message 1 of 5 , Aug 26, 2009
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "douglascrockford" <douglas@...> wrote:
      >
      > The confusion is with the sequence -]. Does it mean
      > \-]
      > or
      > -\]]
      >
      > JSLint is not smart enough to figure that out. Neither are most of us.
      > So code it like you mean it.
      >

      Changing the sequence to /[-\.\/]/g gives me "Unescaped '-'."
      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).
    Your message has been successfully submitted and would be delivered to recipients shortly.