To illustrate the time difference it can make, I have made a macro, one with Python "findall" function, the other with the "For Each" loop currently KM provides.
I don't know how to display time with smaller than 1s unit. I just use the %Longtime% token. The difference is evident. My variable has 5,000 lines (each line has only 1-4 chinese characters followed by a Tab, then 1-4 English letters.
RegEx - Global Search - Python Gobal vs KM For Each loop.kmmacros (61.8 KB)
Using Python "findall" function, I can get the result in less than 1 second. Using the "For Each" loop KM provides, it takes 15 seconds.
In this example, I could simply use RegEx, replacing \t\w+
with nothing. But this is irrelevant to my point. My original variable has other text elements. Therefore, this RegEx search is the best solution for me. Also, my original variable has more than 80,000 lines. Due to the limit of the environment variable size, I reduced it to 5,000 lines. It would take the "For Each" loop more than 1 min to complete the 80,000 lines task!
I hope I have made my case here.