Skip to content
首页 » 科技|网络 » RegEx 选中除特定字符串外的所有行

RegEx 选中除特定字符串外的所有行

如果想选中除了包含 red, green, blue 这三个单词之外的所有行,可使用如下正则表达式:

^(?!.*(red|green|blue))

如果想选中(不含 red, green, 或 blue)、但是(包含 engine)的所有行,表达式如下:

^(?!.*(red|green|blue)).*engine

参见 stackoverflow 上对此的讨论

生于湖南,求学于北京,先后在广东、北京、DC 工作。一代移民,生活在美东小镇。

Disclosure: We are an Amazon Associate. Some links on this website are affiliate links, which means we may earn a commission or receive a referral fee when you sign up or make a purchase through those links.

相关文章


Discover more from 美国攻略

Subscribe to get the latest posts sent to your email.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stock images sponsored by depositphotos.com | Skimlinks