Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #188906

Re: codesearch across lines

From The Wanderer <wanderer@fastmail.fm>
Newsgroups linux.debian.user
Subject Re: codesearch across lines
Date 2017-11-12 14:20 +0100
Message-ID <uL0l4-K6-9@gated-at.bofh.it> (permalink)
References (1 earlier) <uKDHP-28K-5@gated-at.bofh.it> <uKEXf-2U0-3@gated-at.bofh.it> <uKHs6-4FR-7@gated-at.bofh.it> <uKMUN-86K-3@gated-at.bofh.it> <uKY9z-7tU-13@gated-at.bofh.it>
Organization This space intentionally left blank.

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 2017-11-12 at 05:57, Curt wrote:

> On 2017-11-11, kamaraju kusumanchi <raju.mailinglists@gmail.com>
> wrote:
> 
>> On Sat, Nov 11, 2017 at 9:08 AM, Curt <curty@free.fr> wrote:

>>> '(?i) PanDas' seemed to work.
>>> 
>> Ok. That works and does case insensitive search. But the
>> corresponding multiline option does not seem to achieve what I
>> want. I tried
>> 
>> (?m) pandas str
>> 
>> and it dies not give any results.

That would be because this is most likely searching for the literal
sequence ' pandas str' somewhere in the document. (Vs., previously,
searching for lines in the document which contain that literal sequence.)

> It doesn't die for me. It gives no results, though.
> 
> This "works" (for an arbritrary meaning of "work" because I am not
> cut out for regular expressions or even irregular expressions and I
> feel a migraine coming on):
> 
> (?m)(\W|^)panda.*str(\W|$)

That would be expected to find only documents containing 'panda'
followed by 'str'. To also find ones which contain 'str' followed by
'pandas' (and add the missing 's' back in), you'd probably want:

(?m)(\W|^)(pandas.*str|str.*pandas)(\W|$)

I have not tested this, but I use similar '(a.*b|b.*a)' regexes on a
semi-regular basis for searching one of my own text archives.

(Also, I'm not sure the '\W' bits are needed, but I don't know the field
of what's-being-searched-for well enough to be certain about why those
may have been added.)

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

codesearch across lines kamaraju kusumanchi <raju.mailinglists@gmail.com> - 2017-11-11 05:20 +0100
  Re: codesearch across lines Roberto C. Sánchez <roberto@debian.org> - 2017-11-11 14:10 +0100
    Re: codesearch across lines kamaraju kusumanchi <raju.mailinglists@gmail.com> - 2017-11-11 15:30 +0100
      Re: codesearch across lines Curt <curty@free.fr> - 2017-11-11 18:10 +0100
        Re: codesearch across lines kamaraju kusumanchi <raju.mailinglists@gmail.com> - 2017-11-12 00:00 +0100
          Re: codesearch across lines Curt <curty@free.fr> - 2017-11-12 12:00 +0100
            Re: codesearch across lines The Wanderer <wanderer@fastmail.fm> - 2017-11-12 14:20 +0100
              Re: codesearch across lines Curt <curty@free.fr> - 2017-11-12 15:30 +0100
                Re: codesearch across lines Richard Owlett <rowlett@cloud85.net> - 2017-11-12 16:20 +0100

csiph-web