A few notes:
- There’s tabs in the file for indentation so it’s invalid YAML, I can’t install it as-is.
- I think the general approach of having different regex selectors is good and should work, although it might be even easier to collapse the first three actions into onw and handle the different cases into the code itself.
- The overall regex at the top won’t do anything since it will be overriden by the regexes for each action. So it can be removed.
- The regex syntax and some of the JS looks a bit suspect!
I think it could probably be done fairly simply with a few tweaks, but I’d just need to understand the requirements exactly to make a suggestion.