Remove /* */ comments

By email:

Hello, I’m a Popclip fan.
A question about a feature:
when coding, I often create lines like /* margin: 1rem; */
My wish would be to have a popclip function that would be able to delete the /* */ elements.

Is popclip able to do that?

Here’s a snippet for that:

// #popclip
// name: Remove /* */
// icon: strike monospaced /*
// language: javascript
popclip.pasteText(
  popclip.input.text.replace(/\/\*\s*|\s*\*\//g, '')
);

(The above block is an extension snippet — select it then click “Install Extension” in PopClip.)

In use:
CleanShot 2025-04-23 at 09.47.16

// #popclip
// name: Remove /* */
// icon: strike monospaced /*
// language: javascript
popclip.pasteText(
  popclip.input.text.replace(/\/\*+\s*|\s*\*\//g, '')
);

Maybe it would be better to match /** by the way. :thinking:

1 Like