Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys, what i want to do is search a rtf text inside a richtextbox and replace all instances of a string, only if the string exactly matches the comparison string.
I tried using the RTB.Replace method and I also defined a StringComparison object to help compare the strings when jumping from one another. But if for example I have the text "aa aaaca" and i'm searching for aa to replace with bbb then i'll have something like "bbb bbbaca", instead of just "bbb aaaca"
Any help?
Posted

1 solution

try to do that with Regex class.(System.Text.RegularExpression.Regex)..
this is the link..

http://tim.oreilly.com/pub/a/oreilly/windows/news/csharp_0101.html

read how to replace the string in "Replacing Strings" just after the "Simple Matches"
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900