How can I use emeditor to find and extract regex strings but maintain the same lines +/- a delimiter?
The output I get when I try to extract displayed strings, extracts each matched string to a new line. But my goal is to extract these matches from each line (removing the values I dont want)
For example
Starting with:
dog cat food
prince dog food
I would like to end up with
dog food
prince food
Or
with a delimiter
dog, food
prince, food
But using Emeditor
(\b\w+\b)$|^\w+
and then selecting Regular expressions and extract>display matched strings onlythe ouput is
dog
food
prince
food
Can this be accomplished using EmEditor or through a macro?
Use the Filter toolbar instead of the Find dialog.
^\w+|\w+$
, in the Filter drop-down list box.In the Filter Extract Options dialog box, select Extract all matched strings, and enter \t
or ,
as a Delimiter. Click OK.
Click the Extract All button again in the Filter toolbar, then select Extract Matched Strings in the popup menu.
If you record this procedure to a macro, you will get a macro like this:
document.Filter("^\\w+|\\w+$",0,eeFindReplaceRegExp,0,0,0,0,0);
editor.ExecuteCommandByID(4084); // Extract Matched Strings
If you need to run this macro against many files in a folder, please see: Emeditor: run a macro for all file inside a folder?