c# - Remove unicode hex values using regex -
i need remove several different hex values string of product descriptions.
example: "sale on coolitem™ watch
" or "deal buster on rmkhoody™ signed
"
™ ™
are few hex strings in large database.
i need reg exp replace each empty string.
result : "sale on coolitem watch
" or "deal buster on rmkhoody signed
"
what reg exp find semi-col , select forward & , replace entire selection?
update/solution-working code
string s = "sale on coolitem™ watch" var cleanproductname = regex.replace(s, @"&#x?[^;]{2,4};", string.empty); cleanproductname = "sale on coolitem watch" string s = "deal buster on rmkhoody™ signed" var cleanproductname = regex.replace(s, @"&#x?[^;]{2,4};", string.empty); cleanproductname = "deal buster on rmkhoody signed"
you can use
var cleanproductname = regex.replace(s, @"&[^;]{1,6};", string.empty);
for more spec char such ® . ™ . °
you try &#x?[^;]{2,4};
, meaning: &#
followed 0 or 1 x
followed 2 4 characters not ;
, followed ;
.
Comments
Post a Comment