Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4743

String#numeric? incorrectly uses ^ and $ anchors and groups

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 7.1.0.rc0, 6.4.5, 7.0.4
    • Affects Version/s: None
    • Component/s: None
    • None

      In Ruby \A and \z should be used to refer to the beginning and end of the input string. ^ and $ mean beginning/end of line. As a result:

      irb(main):005:0> "a\nNaN".numeric?
      => 2
      

      It looks like the OR condition should be in a group as well.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: