c# - how to replace richtextbox.rtf if and only if the whole word match? -
my original replace code is.
rttextarea.rtf = rttextarea.rtf.replace(oldtext, newtext);
but problem replaces occurence of words instead of required word e.g origianl word :- hello name serak , in state of israel replace() -- whole word chages "are serak , in arereal"
is there anyway can include status or match whole word? working environment c#.
use regular expressions. in illustration \b
represents word boundary.
var regexp = new system.text.regularexpressions.regex(@"\bis\b"); rttextarea.rtf = regexp.replace(rttextarea.rtf, "are");
c# .net
No comments:
Post a Comment