Closed joshgold22 closed 4 years ago
OK, now %REPLACE(...)%
is supported. It takes one base text and one or more matcher/replaced-text pairs, like: %REPlACE("base text", "matcher regexp 1", "replaced 1", "matcher regexp 2", "replaced 2", ...)%
The matcher part is treated as a JavaScript regular expression, case-insensitive and not global match. So, you can define exception domains with a negative lookahead. For example:
%REPLACE("%URL%", "^((?!\w+://([^/]*\.)?(google\.com|duckduckgo\.com)/.*).*)\?.*$", "$1")%
The automated test may help you to understand detailed specs of the %REPLACE(...)%
feature:
https://github.com/piroor/copy-selected-tabs-to-clipboard/blob/master/test/test-replacer.js
Short description
Either or both of the following would be helpful, but especially the first:
(e.g., given https://www.nytimes.com/interactive/2020/05/19/burst/compost-box-indoors-coronavirus.html?action=click&module=Top%20Stories&pgtype=Homepage&contentCollection=AtHome&package_index=0 copies https://www.nytimes.com/interactive/2020/05/19/burst/compost-box-indoors-coronavirus.html )
To comment on priority, I would find 1 most helpful (and certainly most worthwhile versus the effort!) I would also find 1. helpful even if 2. is provided: Sometimes I'd want to strip arguments no matter the domain; and having 1. allows the user to decide how it will be copied when they choose a format from the menu.