5

I'd like to "AND" search text in spesific multiline range in a file by regex with ag(the_silver_searcher). But the regex pattern not work.

Following regex pattern works well.

ag --multiline -G "^.*\.(md|txt)$" -C 1 -S "foo(\n|.)*baz" ./dev_note.md

(output)

40-
41:foo
42:bar
43:baz
44-

But following regex pattern will output nothing.(no matched)

ag --multiline -G "^.*\.(md|txt)$" -C 1 -S "(?=(.|\n)*(foo))(?=(.|\n)*(baz))" ./dev_note.md

Also I tried: ag --multiline -G "^.*\.(md|txt)$" -C 1 -S "(?=(.|\n)*(foo))(.|\n)*(?=(.|\n)*(baz))" ./dev_note.md

k23j4
  • 723
  • 2
  • 8
  • 15

0 Answers0