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

Re: help for extended regexp

Expand Messages
  • Doug Kearns
    ... This is what I originally thought but upon reflection it didn t seem to make sense, or at least it wasn t what I d expect. ... Thanks, I agree this is
    Message 1 of 7 , Sep 7, 2001
      On Fri, Sep 07, 2001 at 03:37:40PM +0200, Bram Moolenaar wrote:
      >
      > Doug Kearns wrote:
      >
      > > Further,
      > >
      > > // hello there in disneyland
      > >
      > > "\(\/\/.\{13}\)\@\<!in" matches 'in' as expected but,
      > > "\(\/\/.*\)\@\<!in" does not.
      > >
      > > Hmmmm........... am I missing something ?
      >
      > The problem is that Vim tries to match as much as possible with ".*".
      > This means that "\/\/.*" will continue until the end of the line, and
      > not end just before the "in". That is what "\@<!" checks for, the
      > match
      > must end at the point it currently is.

      This is what I originally thought but upon reflection it didn't seem to
      make sense, or at least it wasn't what I'd expect.

      > To make the match end before the "in" this can be used:
      >
      > \(\/\/.*\(in\)\@=\)\@<!in
      >
      > However, this doesn't work when "in" appears twice...
      >
      > The regexp code could be changed to make the ".*" stop at the current
      > position. I think this is not only expected, but it's neede to avoid
      > making the regexp very difficult.
      >
      > OK, please try out this patch as much as you can. It's not completely
      > compatible, in that it finds more matches than before. But this is
      > probably what you would expect to happen.

      Thanks, I agree this is better. I'll give it a work out :)

      <snip>

      Regards,
      Doug
    Your message has been successfully submitted and would be delivered to recipients shortly.