regex - Regular Expression to remove all numbers and all dots -
i have code in vb.net :
messagebox.show(regex.replace("example 4.12.0.12", "\d", "")) it removes/extracts numbers
i want remove dots
so tried
messagebox.show(regex.replace("example 4.12.0.12", "\d\.", "")) but keeps numbers.
how remove both (numbers & dots) string ?
thanks.
try using character group:
messagebox.show(regex.replace("example 4.12.0.12", "[\d\.]", "")) i'll elaborate since inadvertently posted same answer steven.
given input "example 4.12.0.12"
"\d"matches digits, replacement gives"example ...""\d\."matches digit followed dot, replacement gives"example 112""[\d.]"matches digit or dot. steven said, it's not necessary escape dot inside character group.
Comments
Post a Comment