why does this regular expression match?

Discussion in 'Ruby' started by dominique.plante@gmail.com, Mar 10, 2006.

  1. Guest

    Using Test::Unit:

    r1 = /a*/
    assert_nil,'A' =~ r1

    The error I get implies that it would match in the same way that the
    following would match
    'a' =~ r1

    Can anyone offer any suggestions?

    Thanks!
    Dominique

    ps. done a google search on Test::Unit lately?
    , Mar 10, 2006
    #1
    1. Advertising

  2. 1337p337 Guest

    The asterisk means "Zero or more of these". You may want to use /a+/
    (One or more 'a's).

    On 09/03/06, <> wrote:
    > Using Test::Unit:
    >
    > r1 =3D /a*/
    > assert_nil,'A' =3D~ r1
    >
    > The error I get implies that it would match in the same way that the
    > following would match
    > 'a' =3D~ r1
    >
    > Can anyone offer any suggestions?
    >
    > Thanks!
    > Dominique
    >
    > ps. done a google search on Test::Unit lately?
    >
    >
    >
    1337p337, Mar 10, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. championsleeper
    Replies:
    6
    Views:
    1,001
    championsleeper
    Apr 6, 2004
  2. Liang
    Replies:
    2
    Views:
    1,671
  3. VSK
    Replies:
    2
    Views:
    2,279
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,803
    Smokey Grindel
    Dec 2, 2006
  5. jm
    Replies:
    5
    Views:
    87
    Tad McClellan
    Nov 2, 2006
Loading...

Share This Page