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

Re: RegExp error: Unexpected '.'.

Expand Messages
  • pauanyu
    ... Sorry, but no. The escaped . matches only the period. Here s some proof: alert(/ ./.exec( a. )); alert(/./.exec( a. ));
    Message 1 of 11 , May 29, 2009
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "christian.wirkus" <christian.wirkus@...> wrote:
      >
      > the escaped . matches anything, i think
      > try it out
      >

      Sorry, but no. The escaped . matches only the period.

      Here's some proof:

      alert(/\./.exec("a."));
      alert(/./.exec("a."));
    • christian.wirkus
      Hm, you re right. The regexps tricked once more. Thanks.
      Message 2 of 11 , May 30, 2009
      • 0 Attachment
        Hm, you're right. The regexps tricked once more. Thanks.

        --- In jslint_com@yahoogroups.com, "pauanyu" <pcxunlimited@...> wrote:
        > Sorry, but no. The escaped . matches only the period.
        >
      • Michael Lorton
        Some people, when confronted with a problem, think I know, I’ll use regular expressions. Now they have two problems. — Jamie Zawinski That quote is a
        Message 3 of 11 , May 30, 2009
        • 0 Attachment
          "Some people, when confronted with a problem, think 'I know, I’ll use regular expressions.' Now they have two problems."
          — Jamie Zawinski


          That quote is a little unfair, but not entirely inaccurate. Christian's problem may have been that the regexp generated by

          new RegExp('\.')
          will match any character, but the one generated by

          /\./
          will only match the period.

          M.




          ________________________________
          From: christian.wirkus <christian.wirkus@...>
          To: jslint_com@yahoogroups.com
          Sent: Saturday, May 30, 2009 9:28:38 AM
          Subject: [jslint] Re: RegExp error: Unexpected '.'.

          Hm, you're right. The regexps tricked once more. Thanks.

          --- In jslint_com@yahoogroups.com, "pauanyu" <pcxunlimited@...> wrote:
          > Sorry, but no. The escaped . matches only the period.
          >




          ------------------------------------

          Yahoo! Groups Links



          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.