I have this RegEx search set up. Whenever this action is visible, KM editor freezes.
Update: Not even when the action is visible.
It was a mistake. I should have escaped the two *
.
CPU consumption immediately goes to 100%.
I have this RegEx search set up. Whenever this action is visible, KM editor freezes.
Update: Not even when the action is visible.
It was a mistake. I should have escaped the two *
.
CPU consumption immediately goes to 100%.
I don't see an obvious purpose of the RegEx, but that is normal.
I'd suggest you open your RegEx and sample data in Regex101.com and see if it is working there.
Chances are that there is something wrong with the RegEx.
Like I said, it was a mistake. But it freezes KM. Therefore, I wanted to report it. Maybe something with KM caused the problem.
PHP uses this for block comment:
/*
test strings1
test strings2
*/
I wanted to create macros to block comment and UN(block comment).
This search was intended for UN(block comment), i.e., get everything between /*
and */
.
I believe the pattern should be like this:
\/\*\n((.|\n)*?)\n\*\/
or without the question mark:
\/\*\n((.|\n)*)\n\*\/
Thanks for reporting, but I can't reproduce the behavior of freezing KM:
KM Engine log shows a normal execute macro:
2020-09-01 20:41:44 Execute macro “Regex Test for Locking Up KM @TEST” from trigger Editor
I'm running Keyboard Maestro 9.0.6 on macOS 10.14.6 (Mojave).
What versions are you running?
I use KM 9.0.6 on macOS Catalina.
I have deleted the macro. I don't remember what I put in the variable field.
I can't even reproduce it now. But that macro freezes every time I click on it. I finally use keyboard arrow key to switch to it and as soon as I switched to it, I hit the delete key to delete it. Unless there is a way to restore that macro. I don't know what I can. I should have took a screenshot of the whole thing.
While trying to reproduce it, I did another test.
When the string is short, such as that in the example above, it won't cause any problem. But when it is a complex one, this search pattern will cause some problem, but to the Keyboard Maestro Engine this time, not the Keyboard Maestro Editor.
Here is the example:
The green one, Search and Replace will cause KM engine to work at 100% CPU level, while the orange one, just RegEx search, will have no issue at all.
Again, this is not the same with the one I described at first. This time, it is the Engine, not the Editor. So I guess the Engine was trying heard to search for a match.
Here is the test string.
/*
function endsWith( $variable, $startWithString ) {
$length = strlen( $startWithString );
if ( !$length ) {
return true;
}
return substr( $variable, -$length ) === $startWithString;
}
*/
I restored a version from Dropbox. It looks like there is no special thing about the macro except that it was set to search in the clipboard.
Initially, my clipboard was a screenshot, KM editor was about 30% CPU level. Then I switched the clipboard to a text, it immediately went up to 100% CPU level.
clipboard history from Pasta.
PHP - UNblock comment.kmmacros (5.2 KB)
I have uploaded the macro for anyone interested to give it a try.
I don't know if it is reproducible. I recommend the following steps: