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

29898Re: Searching for words that are repeated more than once consecutively

Expand Messages
  • Gary Holloway
    Jul 2 5:29 PM
      / FROM: Preben Peppe Guldberg <c928400@...>, Jul 2 20:51 2002
      | ABOUT: Re: Searching for words that are repeated more than once consecutively
      |
      | Thus wrote Bram Moolenaar (Bram@...) on [020702]:
      |
      | > Yegappan Lakshmanan wrote:
      |
      | > > How do I search for words that are repeated consecutively more
      | > > than once? For example, search for "the the" or "a a", etc.
      | > > Note that the word is an arbitrary word (i.e. I cannot just
      | > > search for /the the or /a a).
      |
      | > /\(\<\k\+\>\)\s\+\1
      |
      | I'd say that should be
      |
      | /\(\<\k\+\>\)\s\+\1\>

      Actually, I'd use:

      /\(\<\k\+\>\)\(\_s\+\<\1\>\)\+

      After all, you wanna find "the the the", right? :)
      (and of course,
      the
      the
      the
      )

      Now, is there a way to skip a comment leader?
      To find something like:

      /* This comment repeats the
      * the word, "the" consecutively.
      */

      Which would be one of the more common cases of a repeated word you'd miss. :)

      -gary

      |
      | or "an anchor" will be matched, too.
      |
      | Peppe
      | --
      | "Before you criticize someone, walk
      | Preben "Peppe" Guldberg __/-\__ a mile in his shoes. That way, if
      | c928400@... (o o) he gets angry, he'll be a mile away
      | ----------------------oOOo (_) oOOo-- - and barefoot." --Sarah Jackson
      |
      \ END: Preben Peppe Guldberg
    • Show all 10 messages in this topic