---
title: "Wrap in Parentheses action for ActionClip"
canonical_url: "https://actionclip.app/actions/wrap-in-parentheses"
document_type: "standalone_action"
official: true
action_count: 1
catalog_schema_version: 1
catalog_revision: "2026-08-21.1"
catalog_published_at: "2026-08-20T18:50:00Z"
---

# Wrap in Parentheses action for ActionClip

Toggle parentheses around selected text.

## What it does

Adds parentheses while keeping surrounding whitespace outside them. Running it again removes one matching pair.

## Action details

| Field | Value |
| --- | --- |
| Category | Text Editing & Formatting |
| Action type | JavaScript |
| Result | Replace or copy text |
| Internet | Not required |

## Action and outcome

| Action | Outcome |
| --- | --- |
| **Wrap in Parentheses** — Selected text: optional | (optional) |

## How to toggle parentheses around selected text with ActionClip

1. Select the text you want to use.
2. Choose **Wrap in Parentheses** from ActionClip.
3. Review the result, then replace the selection or copy the new text.

## Requirements

No setup required.

## Privacy

Runs locally in ActionClip’s JavaScript sandbox. Selected text does not leave your Mac.

## Action configuration

````javascript
function run(selected_text) {
  const match = selected_text.match(/^(\s*)([\s\S]*?)(\s*)$/);
  const leading = match[1];
  const content = match[2];
  const trailing = match[3];
  if (content.length >= 2 && content.startsWith("(") && content.endsWith(")")) {
    return leading + content.slice(1, -1) + trailing;
  }
  return leading + "(" + content + ")" + trailing;
}
````

## Links

- [HTML listing](https://actionclip.app/actions/wrap-in-parentheses)
- [Download action definition](https://actionclip.app/actions/wrap-in-parentheses.actionclip)
- [Browse Text Editing & Formatting actions](https://actionclip.app/marketplace#marketplace-textTools)
- [All Marketplace listings](https://actionclip.app/marketplace)
