EmEditor (text editor) Forum Index Questions and Answers about EmEditor Core
check group status | Register To Post |
| Threaded | Newest First | Previous Topic | Next Topic | Bottom |
| Poster | Thread |
|---|---|
| user | Posted on: 5/3/2012 7:24 am |
Home away from home ![]() ![]() Joined: 9/29/2006 From: Posts: 212 |
check group status hello!
can anyone help me achieve this please (I dont know if regex or macro or anything else is the appropriate way): I have a text with many lines in this format: GROUP1{TAB}ITEM1{TAB}SENT GROUP1{TAB}ITEM2{TAB}SENT GROUP2{TAB}ITEM3{TAB}SENT GROUP2{TAB}ITEM4{TAB}NOT SENT GROUP2{TAB}ITEM5{TAB}SENT GROUP1, GROUP2, etc are multidigit numbers ITEM1, ITEM2, etc are any kind of characters sequence, including TABs, spaces, etc the logic is that if in a GROUP, there is a single or more ITEM that is NOT SENT, then the whole GROUP must be marked as NOT SENT if all items of a GROUP are SENT, then the GROUP is marked as SENT so I want, with a click, to transform the above text into: GROUP1{TAB}SENT GROUP2{TAB}NOT SENT any solution? thanks! |
| user | Posted on: 5/7/2012 11:55 pm |
Home away from home ![]() ![]() Joined: 9/29/2006 From: Posts: 212 |
Re: check group status anyone???
|
| Stefan | Posted on: 5/8/2012 1:03 am |
Home away from home ![]() ![]() Joined: 7/14/2008 From: Germany, EU Posts: 263 |
Re: check group status Quote:
Try (with an copy of your file!) this RegEx search & replace: FIND: (.+?\t).+\t(NOT SENT|SENT) REPL: $1$2 [X] Use Regular Expressions Explanation: (.+?\t) = match and store all non-greedy till the first TAB into group $1 .+ = match all, but only till: \t(NOT SENT|SENT) = an TAB followed by "not sent" OR "sent", which ever is stored in $2 . |
| user | Posted on: 5/8/2012 9:47 am |
Home away from home ![]() ![]() Joined: 9/29/2006 From: Posts: 212 |
Re: check group status great thanks!
how do I count the instances of a match and store the amount in a variable? |
| Stefan | Posted on: 5/8/2012 10:36 am |
Home away from home ![]() ![]() Joined: 7/14/2008 From: Germany, EU Posts: 263 |
Reg Ex search and replace macro Quote:
Do the RegEx s&r with an macro. For example i have found that this JavaScript macro could be an base for your issue: |
| Threaded | Newest First | Previous Topic | Next Topic | Top |
| Register To Post | |



