Results 1 to 3 of 3

Thread: I have a regular expression (regex) question...

  1. #1

    I have a regular expression (regex) question...

    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.

  2. #2
    Regular Member
    Join Date
    Aug 1999
    Posts
    341
    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:
    \(#[^)]+\)

  3. #3
    Quote Originally Posted by complete View Post
    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.
    You can delete the subkey like

    rKey = Registry.LocalMachine.OpenSubKey("Software", true);
    rKey.DeleteSubKey("AppReg", true);

    if you not clear look:

    http://net-informations.com/csprj/ov...operations.htm

    chris.

Similar Threads

  1. Paris Hiltons Never changing facial expression
    By Joe in forum General Discussion Board
    Replies: 11
    Last Post: 11-23-05, 10:17 AM
  2. A Whole New Meaning to the Expression "Blood Shot Eyes"
    By minir in forum General Discussion Board
    Replies: 8
    Last Post: 09-21-04, 01:27 PM
  3. Just a regular question...
    By Freddy in forum Software Forum
    Replies: 2
    Last Post: 07-20-02, 06:32 PM
  4. Replies: 2
    Last Post: 09-27-01, 10:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •