I have a regular expression (regex) question...
How would I use regular expressions to remove the contents in parenthesis in a string in C# like this:
"SOMETHING (#2)"
The part of the string I want to remove always appears within paranthesis and they are always # followed by some number. The rest of the string needs to be left alone.
I have a regular expression (regex) question...
I'm not sure about the C# part (I would imagine it would be done using Regex.Replace based on a quick googling), but one regex that would do the trick is this:
Code: Select all
\(#[^)]+\)
-
- New Member
- Posts: 1
- Joined: Thu Jul 26, 2012 1:16 pm
You can delete the subkey likecomplete wrote:I have a regular expression (regex) question...
How would I use regular expressions to remove the contents in parenthesis in a string in C# like this:
"SOMETHING (#2)"
The part of the string I want to remove always appears within paranthesis and they are always # followed by some number. The rest of the string needs to be left alone.
rKey = Registry.LocalMachine.OpenSubKey("Software", true);
rKey.DeleteSubKey("AppReg", true);
if you not clear look:
http://net-informations.com/csprj/overv ... ations.htm
chris.