Script: Grep and paste
Created at 2007-08-21 by ciukes
/* * Menu: Text > Grep and paste * Kudos: ciukes * License: EPL 1.0 * DOM: http://monkey.brain-bakery.com/update-site/com.brainbakery.eclipse.monkey.dom.editors * References: * */ function main() { var sourceEditor = bb_editors.activeEditor; var valid = true; // make sure we have an editor if (sourceEditor === undefined) { valid = false; showError("No active editor"); } if (valid) { regex = ask_pattern(); output_editor=bb_editors.createEmpty() if (output_editor!=null){ for each(line in sourceEditor.lines) { if (line.match(regex)) { output_editor.appendLine(line) } } } } } function ask_pattern() { dialog = new Packages.org.eclipse.jface.dialogs.InputDialog( window.getShell(), "Regular expresion to match", "Expresion to match?", ".*", null) result = dialog.open() if (result == Packages.org.eclipse.jface.window.Window.OK) { return dialog.getValue(); } }
Comment:
Find expression and copy to new editor.
Tags:
selection expression editor find copy