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

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -