Replacing characters within a text with regex in c# -


i trying replace few characters text. these characters maybe start or end or may in middle. problem hasn't white space @ starting or ending. example want replace "text" text with, instance, "abc".

input: thisisatextbox

output: thisisaabcbox

i tried code far.

regex.replace(textbox.text, @"\w[text]", "abc"); 

any appreciated. thanks!

use following.. [ ] has special meaning (character class) in regex:

regex.replace(textbox.text, @"text", "abc"); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -