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

39153A Change in Pattern Matching?

Expand Messages
  • Johnny Blaze
    Mar 1, 2005
      Call me crazy, but I could have sworn

      :echo matchstr('aaaaa', '\(\%(a\| \)\+\)')
      aaaaa

      instead Vim 7 (as of 2/28) returns:

      :echo matchstr('aaaaa', '\(\%(a\| \)\+\)')
      a

      since \%(\) groups, but doesn't create submatches, whereas \(\)
      does.... If I change \+ to * it returns as expected, which seems to
      confirm my suspicions as * matches 0 to many (greedy), while \+
      matches 1 to many (greedy).

      Any ideas?
      --

      . o O pyromancer O o .
    • Show all 3 messages in this topic