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

Re: regexp

Expand Messages
  • Douglas Crockford
    ... You are correct that these things don t HAVE to be escaped. I recommend that you escape them anyway as a general approach to error avoidance.
    Message 1 of 4 , Oct 27, 2008
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "crlender" <crlender@...> wrote:

      > In a regex character class, parentheses don't have a special meaning
      > and don't need to be escaped. In a similar vein, I've seen JSLint
      > complain about character classes like [#+-], saying that the "-"
      > should be escaped. Since it's at the end of the list (which is the
      > recommended practice in this case), it can't be part of a range, and
      > doesn't have to be escaped.

      You are correct that these things don't HAVE to be escaped. I
      recommend that you escape them anyway as a general approach to error
      avoidance.
    • firstbakingbook
      Is there a simple method that jslint would be happy with for removing all matching substrings like str.replace(/#[^ n]*/g, ) (cutting all text starting with
      Message 2 of 4 , Jul 27, 2012
      • 0 Attachment
        Is there a simple method that jslint would be happy with for removing all matching substrings like

        str.replace(/#[^\n]*/g, '')

        (cutting all text starting with #, from all lines in the input)?
      Your message has been successfully submitted and would be delivered to recipients shortly.