我有这样的输出:什么是正则表达式来打印没有指定单词的行?
---------- snippet start ----------
JUnit version 4.11
I.E
Time: 0.015
There was 1 failure:
1) testPerson(PersonTest)
org.junit.ComparisonFailure: expected:<John[1]> but was:<John[]>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at PersonTest.testPerson(PersonTest.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
---------- snippet end----------
,我想只提取并没有“在”字在每一行的开头线,但不包括线(与“AT”),其包含单词“PersonTest.java” 非常感谢!
为什么不使用期望'at'的正则表达式出现在行的开始处,并在正则表达式失败时检索行? – Patashu
你也可以使用'grep',如果你不需要以编程方式做,例如:''grep -v“在'' – rednaw
就像在循环中使用它,我不能这样做AFAIK,我只能使用正则表达式,不能使用编程语言,它是编译后我的IDE输出,我想尽量减少它给出的噪音。无论如何感谢 – 0x726364