Here is a RegEx solution.
I copied the sample text you provided into C:\Temp\Temp.txt to load the Haystack.
The syntax for something NOT IN THE LINE is:
^((?!regexp).)*$
So I had to get the "regexp" value first. The following script does that.
Code: Select all
Let>vNeedle=(?m)^[A-Z]{3}%space%[0-2].*?$
// Let>vHaystack=
ReadFile>C:\temp\temp.txt,vHaystack
Let>vReplacement=
RegEx>%vNeedle%,%vHaystack%,0,vMatch,vMatchCount,0,%vReplacement%,vNewString
MessageModal>Matching line count is %vMatchCount%
This results in a count of 29 lines that match the format you want. Each of the lines is now a variable named vMatch_1 through vMatch_29. You could now use the vMatchCount in a loop to write each of the matching lines into a new file or concatenate a variable and you will be all done.
--------------------------------
Or you could do a RegEx Replacement per my original suggestion.
No time to do it now, but you should be able to use the needle in the code above in a new needle using the NOT IN THE LINE syntax
^((?!regexp).)*$, replacing "regexp" with the original needle.
It will need some modification to handle the ^ and the $. The vReplacement could probably be blank, replacing each of the NON matching lines with nothing.
----------------
I always use the same structure for my Regex code. Only have to change 4 simple areas that are
bolded.
Let>vNeedle=my search pattern goes here
//Let>vHaystack=my simple test search source goes here
...... OR
ReadFile>C:\temp\temp.txt,vHaystack
Let>vReplacement=my replacement pattern goes here
RegEx>%vNeedle%,%vHaystack%,0,vMatch,vMatchCount,0,%vReplacement%,vNewString
MessageModal>Matching line count is %vMatchCount%
I define what I am looking to match as the Needle
I define the text I am searching through as the Haystack. Usually use a short string for simple strings, OR a temp text file for longer, final sources.
There is a line there for vReplacement that could be commented out, but since the value in the RegEx expression is "0" it does not really matter. I can activate it by simply changing the 0 to a 1.
Then I run the RegEx line, only needing to change the Replacement value as noted above, the other values are all variables and need no change.
Finally, for test purposes I show a count of the matches, and usually have the Watch List open so I can see each of the matching values.