EmEditor (text editor) Forum Index Questions and Answers about Macros
delete all lines that match any of the regexes that are in a txt file | Register To Post |
| Threaded | Newest First | Previous Topic | Next Topic | Bottom |
| Poster | Thread |
|---|---|
| user | Posted on: 5/11/2012 12:39 am |
Home away from home ![]() ![]() Joined: 9/29/2006 From: Posts: 212 |
delete all lines that match any of the regexes that are in a txt file hello!
I need a macro that will delete all lines that match any of the regexes that are in a txt file (one below the other) is this possible? thanks! |
| user | Posted on: 5/14/2012 1:43 am |
Home away from home ![]() ![]() Joined: 9/29/2006 From: Posts: 212 |
Re: delete all lines that match any of the regexes that are in a txt file I think I need to make it more clear:
I am looking for a more convenient way than maintaining a list of: document.selection.Replace("^455.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); I just want to have a list of the regex only and then the command to be the same thanks |
| user | Posted on: 5/15/2012 12:43 am |
Home away from home ![]() ![]() Joined: 9/29/2006 From: Posts: 212 |
Re: delete all lines that match any of the regexes that are in a txt file instead of doing the below, is there a way to set a var with the numbers and use a single line?
document.selection.Replace("^918.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^919.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^920.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^921.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^922.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^924.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^925.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^926.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^927.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^928.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^929.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^946.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^972.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1093.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1109.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1166.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1185.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1188.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1189.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1190.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1191.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1192.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1193.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1194.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1196.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1198.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1200.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1223.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1436.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1438.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1439.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1440.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1441.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1442.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1443.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1444.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1466.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1469.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1636.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1637.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1638.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1640.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1641.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1648.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1650.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1862.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1871.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1872.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1874.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1875.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1883.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); document.selection.Replace("^1884.*$", "", eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll); thanks |
| Stefan | Posted on: 5/15/2012 9:16 am |
Home away from home ![]() ![]() Joined: 7/14/2008 From: Germany, EU Posts: 285 |
Re: delete all lines that match any of the regexes that are in a txt file If it allowed to match ANY number between '918' and '1884' ? Then try: Or the showed numbers only? . |
| user | Posted on: 5/16/2012 12:15 am |
Home away from home ![]() ![]() Joined: 9/29/2006 From: Posts: 212 |
Re: delete all lines that match any of the regexes that are in a txt file the shown numbers only
also, in a way that the numbers list will be easily maintained, ie. add and remove entries that's the difficult part :/ |
| Stefan | Posted on: 5/16/2012 3:49 am |
Home away from home ![]() ![]() Joined: 7/14/2008 From: Germany, EU Posts: 285 |
Re: delete all lines that match any of the regexes that are in a txt file Having e.g. "c:\temp\numbers.txt" with one number at each line. c:\temp\numbers.txt: Quote: 123 Use an code like this to read this file into an array. Then use a FOR loop to process each array indices (0 till highest index) and inside the FOR loop use the current index to do what you want. For more about Javascript FileSystemObject and text files read e.g.: http://www.ezineasp.net/post/Javascript-FSO-OpenTextFile-Method.aspx |
| user | Posted on: 5/16/2012 5:41 am |
Home away from home ![]() ![]() Joined: 9/29/2006 From: Posts: 212 |
Re: delete all lines that match any of the regexes that are in a txt file great! thanks!
|
| Threaded | Newest First | Previous Topic | Next Topic | Top |
| Register To Post | |



