Replace whole word with a symbol using C# Regex -


so trying replace word @theplace or @theplaces using regex pattern like:

string pattern = string.format(@"\b{0}\b", placename); 

but when replacement, not finding pattern, guessing @ symbol problem.

can show me need regex pattern work?

your problem* \b (word boundary) before @. there no word boundary between space , @.

you remove it, or replace non-boundary, capital b.

string pattern = string.format(@"\b{0}\b", placename); 

* assuming placename begins @.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -