By Email:
If I copy some text; while pasting, I need to tinker with the copied text; then how can I do that?
For example, if I am copying the math/LaTeX Code:
$x+y=2$ … and when I copy it, by default, it takes, that dollar sign as well and when I want to paste it somewhere else, I no longer required those dollar signs, so how do I get rid of that?
Moreover, this is just a sample question… but I might have more complex situations… for example, I need to remove $ and then the earlier LaTeX environment as well… and similarly, in the last also, $ and subsequent environments, then how to do that?
Is there any quick command to do such kind of thing?
This could be done with a PopClip extension as follows:
// #popclip
// name: Remove $
// regex: \$.+\$
// icon: circle monospaced $
// language: javascript
const result = popclip.input.matchedText.slice(1,-1);
popclip.copyText(result);
(The above block is an extension snippet — select it then click “Install Extension” in PopClip.)
Explanation:
-
the
regex: \$.+\$
matches inputs containing$...$
capturing everything between the first and last$
. -
The
.slice(1,-1)
removes the first and last character -
popclip.copyText()
copies the result to the clipboard.
For other situations, you would of course need to modify the regex and code accordingly. I hope this provides a starting point.