Notepad ++删除所有超过1个冒号的行

时间:2016-06-03 05:46:08

标签: regex notepad++

我想从我的大文本文件中删除所有包含多个冒号的行。

对代码如何工作的解释也将非常感激。

示例:

yes:no:no
yes:no
yes:no
no:yes
yes:yes:no

我想要的是什么:

yes:no
yes:no
no:yes

因此它删除了第一行和最后一行,因为它们有超过1个冒号。

1 个答案:

答案 0 :(得分:2)

使用此:

CTRL + H

<强>查找

export DJANGO_SETTINGS_MODULE="foo.settings.development"

<强>替换:     (什么都不输入)

请注意,我在这里假设Windows行结尾(Use the Snippet for ExpandableListView import android.content.Context; import android.util.AttributeSet; import android.view.ViewGroup; import android.widget.ExpandableListView; public class ExpandableHeightListView extends ExpandableListView { boolean expanded = false; public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public boolean isExpanded() { return expanded; } @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // HACK! TAKE THAT ANDROID! if (isExpanded()) { // Calculate entire height by providing a very large height hint. // But do not use the highest 2 bits of this integer; those are // reserved for the MeasureSpec mode. int expandSpec = MeasureSpec.makeMeasureSpec( Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutParams params = getLayoutParams(); params.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } **** use <classpath for ExpandableHeightListView attribs /> ***** ExpandableHeightListView expListView = (ExpandableHeightListView)findViewById(id); )。如果您在Unix上运行,那么您只需使用.*:.*:.*\r\n 作为行结尾,因此正则表达式将是:

\r\n

以下是一个屏幕截图供参考:

enter image description here