Replace string in brackets in VB.NET

I have string with brackets:

Dim A as String = "Example (example1)"

I want to replace string in brackets with another string so I should get for example...

A = "Example (example2)"


You can use the Regex.Replace Method

Imports System.Text.RegularExpressions

Dim input As String = "Example (example1)"
Dim replacement As String = "example2"
Dim expression As New Regex(\(.*\))
Dim result As String = expression.Replace(input, replacement)

That pattern will match anything in-between two parenthesis including other parenthesis (greedy). Adjust expression to suit your need.

Need Your Help

why are the File.hashCode() different

android sharedpreferences hashcode

This is the code that I use to copy sharedpreference file toand fro from sdcard.

Vodafone Mobile Broadband K3765-Z not working in jessie but was working in wheezy

networking usb debian wireless umts

I was working on Debian stable=wheezy until last week. Using my Surfstick was fine - configured by network-Manager.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.