如何使用正则表达式删除某个具有特定变量的行

Joe*_*Joe 4 regex eclipse replace

    reportdoc.getAttributes().put(ATT_NAME, "report");
    reportdoc.getAttributes().put(ATT_PIXEL_SIZE, "64");

    clouddoc.getAttributes().put(ATT_NAME, "cloud");
    clouddoc.getAttributes().put(ATT_PIXEL_SIZE, "128");
Run Code Online (Sandbox Code Playgroud)

我想删除上面文件中包含ATT_PIXEL_SIZE出现的整行.我应该在eclipse中使用什么正则表达式进行搜索和remove行.

ste*_*ema 8

对我来说这很有效

^.*ATT_PIXEL_SIZE.*\r\n
Run Code Online (Sandbox Code Playgroud)

并且什么也没有替换.但我不确定,可能是你需要另一个只有\r或者像\n.

$ 将无法工作,因为这是一个零宽度断言,它只会匹配最后一个字符和行尾,但不会匹配行本身的结尾.