# Remove text between brackets in string

**URL:** <https://forum.uipath.com/t/remove-text-between-brackets-in-string/115131>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [May 8, 2019, 12:27pm UTC](https://forum.uipath.com/t/remove-text-between-brackets-in-string/115131 "2019-05-08T12:27:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon1302](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jon1302](https://forum.uipath.com/u/jon1302)\
**Post date:** [May 8, 2019, 12:27pm UTC](https://forum.uipath.com/t/remove-text-between-brackets-in-string/115131/1 "2019-05-08T12:27:56Z")

</div>

I’m trying to remove text in a string between brackets. I’m using .Replace(“(\w+)”,“”) but does not seem to be working.

If i have text e.g. Text1 (Text2) Text3 i wanted to remove (Text2) so i am left with e.g. Text 1 Text 3

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [May 8, 2019, 12:37pm UTC](https://forum.uipath.com/t/remove-text-between-brackets-in-string/115131/2 "2019-05-08T12:37:06Z")

</div>

Buddy @jon1302

If stored as in\_text = Text1 (Text2) Text3

**in\_text = split(in\_text," “)(0)+” “+split(in\_text,” ")(2)**

Cheers

---

<div class="post-metadata">

**Author:** ![KannanSuresh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kannansuresh/32/116003_2.png) [@KannanSuresh](https://forum.uipath.com/u/KannanSuresh)\
**Post date:** [May 8, 2019, 12:38pm UTC](https://forum.uipath.com/t/remove-text-between-brackets-in-string/115131/3 "2019-05-08T12:38:22Z")

</div>

You can use regex to replace text. See a sample pattern below.

`\(.*\)`

```
Dim pattern As String = "\(.*\)"
Dim input As String = "Text1 (Text2) Text3"
Dim regex = New Regex(pattern)
Dim output = regex.Replace(input, "")

```

> **[regex101: build, test, and debug regex](https://regex101.com/r/2TMr5t/1)**
>
> Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [May 11, 2019, 12:38pm UTC](https://forum.uipath.com/t/remove-text-between-brackets-in-string/115131/4 "2019-05-11T12:38:29Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
