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

proposed patch for eval.c : match(),matchend(),matchstr() - "nth" argument

Expand Messages
  • Ilya Sher
    ... Hash: SHA1 Hi all. TODO ITEM: todo.txt, line 1671 : match({pat}, {string}, [count]) get index of count th match Little correction: count should be the
    Message 1 of 1 , Feb 10, 2004
    • 0 Attachment
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1

      Hi all.

      TODO ITEM:
      todo.txt, line 1671 :
      match({pat}, {string}, [count]) get index of count'th match

      Little correction: "count" should be the 4th argument as
      match() have "start" argument in 3rd position.

      PATCH:
      Attaching proposed patch for this todo item.
      Patch is done against version 6.2,
      patches 1-248 included

      INFO:
      What i'm not sure is should it be
      if (nth > (long)STRLEN(str) + 1)
      or
      if (nth > (long)STRLEN(str))
      the "+1" should be for zero width match
      that will match anywhere in the string,
      so it can match strlen+1 times. I'm not
      sure this happens in real world....

      TESTED:
      I've played with it and seems it doesn't have
      problems. Any suggested/performed tests are
      very welcome.


      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.2.2 (GNU/Linux)
      Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

      iD8DBQFAKd2iKQCqGJKGZm4RAsIeAJ4lSkunabEnptKJ6nV0RGAx+AeFBACgw/qp
      smmH231VLtikww2dyPuJucA=
      =6VTQ
      -----END PGP SIGNATURE-----
    Your message has been successfully submitted and would be delivered to recipients shortly.