How to search lines that include a word but not other word

Let’s say,
A file’s content is like below,

xy: 132, 2
index: -1
xy: 1, 2926
index: -1
xy: 23, 25
index: 0
xy: 24, 26
index: -1
xy: 29, 53
index: 6

And i want to find every line that includes “index” but not having “-1” value after it.
I want to find them in atom’s search bar(ctrl+F), because i should check the lines around those lines i’m trying to search.

Is there any way to do this?

One approach I use …

Install ripgrep

Use process-palette Atom package to run ripgrep on selected Atom file
using regex syntax to find patterns

1 Like

Search as regular expression, use a “don’t-match-next group”: index: (?!-1).*

1 Like