Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 14th, 2012  |  syntax: None  |  size: 0.32 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Regex replace specified text
  2. Regex rx = Regex(@"s+" + word + @"s+");
  3. str = rx.Replace(str, word2);
  4.        
  5. Debug.Assert(Regex.Match(word, "^w+$").Success);
  6.  
  7. string result = Regex.Replace(input, @"b" + word + @"b", word2);
  8.        
  9. str = Regex.Replace(str ,@"(?<first>s+)" + word + @"(?<last>s+)","${first}" + word2 + "${last}");