hjrshng
hjrshng

Reputation: 1826

Regexp: match and exclude

In this list:

I would like to match only those images that BEGIN with the word image BUT do not contain the word small.

The regex should then return:

So far I have:

/^image(?!.*small)/m

Upvotes: 1

Views: 143

Answers (1)

576i
576i

Reputation: 8362

I tested this with your single lines from the list

 ^image(?!.*_small.*).*\.png$

see also this discussion on how to exclude keywords in regex

Upvotes: 1

Related Questions