SuperEdi

User: Guest

Search

Please use the
Bug Report Form
if you think you found a software defect.

Use the Contact Form
to send a personal message to Wolfgang.

RSS Feed RSS Feed

Other boards:
Juke
QBrowser
Raduga (English)
Song Requester

SuperEdi Script?

Posted on: SuperEdi

From Message

andries van wyk

2005-12-30 09:39:52

SuperEdi Script?

I need a regex script which will enable me to delete all lines contained in a list of about 500 strings from from a 80 000 line hosts file.
Notetab does it as follows but it chokes on any file containing more than 6 000 lines:
^!Replace "^.*badsite.*$" >> "" WASR
^!Replace "^.*doubleclick.*$" >> "" WASR etc.
The WASR bits supresses user input.
How can I do this with SuperEdi?
If it is at all possible don't assume I'm an expert when replying, please!

Wolfgang Loch

2005-12-31 14:44:52

Re: SuperEdi Script?

This one appears to do it:

var lines = new Array();
for( i=0; i<Document.LineCount; i++ ) {
var line = Document.Line(i);
if( line.match( /badsite|doubleclick/ ) ) {
continue;
}
lines.push(line);
}
Document.Text = lines.join("\n");

Go to "Tools|Run Script...", select "JScript" and paste the script text into the box. Then click "Run".

andries van wyk

2006-01-02 07:45:50

Re: SuperEdi Script?

Thanks. Your 2 keyword script works but my 500 keywords does not: the runbox blanks out when I paste.
What am I doing wrong here?
var lines = new Array();
for( i=0; i<Document.LineCount; i++ ) {
var line = Document.Line(i);
if( line.match( /0catch|180solution|207.net|247media|247real|247wsr|2o7|3466690378|3466709097|3721|69sex|abetter|about-tabs|aboutclick|accessplugin|acim|ad-insms|www.ww|www0|www1|www2|zakatron|zedo|zzn/ ) ) {
continue;
}
lines.push(line);
}
Document.Text = lines.join("\n");

Wolfgang Loch

2006-01-02 12:14:47

Re: SuperEdi Script?

Hm, the script box appears to bee too small for that script. Try to save it to a file in the diretory C:\Program files\Wolosoft\SuperEdi\Scripts. Then you can run the script from the Tools/Scripts menu.

By the way, you should escape dots in the regex with a backslash. For example: /207\.net/. Otherwise the dot stands for any character.

Post a reply to this message: