On 2017-11-12 at 05:57, Curt wrote: > On 2017-11-11, kamaraju kusumanchi <raju.mailingli...@gmail.com> > wrote: > >> On Sat, Nov 11, 2017 at 9:08 AM, Curt <cu...@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
signature.asc
Description: OpenPGP digital signature