Please help me select the words within the small brackets, including the brackets themselves so that I can apply formatting to it. Here is a sample text: "This is an apple (red), and that is a banana (yellow). I love mango (green). Do you like radish (white)?

  • \([^)]+\)? "bracket, everything before a closing bracket, closing bracket" Dec 15, 2023 at 7:05
  • BULL'S EYE. That does the magic. Thank you for saving my day. _/_
    – Neel Akash
    Dec 15, 2023 at 7:09

1 Answer 1


The simplest one would be:


\( finds the beginning brackets/parenthesis

.+ finds one or more characters, including spaces

? finds the shortest match

\) finds the closing brackets/parenthesis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.