Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Behält nur die Zeilen, die den Filter-RegExp erfüllen (oder nicht erfüllen)
- res = UltraEdit.getString("Filter (RegExp). Negativ: 'v ' voranstellen",1);
- var positive = true;
- if (res.match(/v\s+(.*)/)) {
- positive = false;
- res = RegExp.$1;
- }
- var re = new RegExp( res );
- var doc = UltraEdit.activeDocument;
- if (!doc.selection.match(/\S/)) doc.selectAll();
- var selection = doc.selection
- .replace( /^\xEF\xBB\xBF/,"") // Unicode-BOM
- .replace( /\x00/g,""); // Unicode-Bytes enfernen
- var lineEnd = selection.match( /[\r\n]{1,2}/ ) || "\r\n" ;
- var lines = selection.split( lineEnd );
- var result = "";
- var lineMatches;
- for (var i=0;i<lines.length;i++) {
- lineMatches = !! lines[i].match(re);
- if (positive == lineMatches) result += lines[i] + lineEnd;
- }
- doc.write( result );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement