Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
正規表現foobarがあり、 foobarに一致しないドキュメント内のすべての行を検索したいとします。これはできますか?どうすればいいですか?
^(?!.*foobar.*).+$
複数行オプションを使用すると、foobar.. を含まないすべての行に一致します。
あなたのケースの正規表現はこれです
^((?!foobar))$
編集:
ただし、grep のみが必要な場合は、-v パラメータを使用できます。
grep -v foobar