Ratha Ratha - 1 year ago 101
Java Question

String.replaceAll not working for "."

I try to replace all "." with "_".

I tried

string.replaceAll("\\.", "_");


string.replaceAll("[.]", "_");

Both are not working. Means "." is not replaced by "_"

Answer Source

Here ma'am try this one.

var str = '. h .e.l.o. HELLO';
var var1 = str.replace(/\./g, '_');



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download