How to Replace only Ip in the below string in file with java file operation var BOSH_URL = "http://192.168.50.107:7070/http-bind/";
var BOSH_URL = "http://192.168.50.107:7070/http-bind/";
Simply use replaceAll
BOSH_URL = BOSH_URL.replaceAll("(\\d+.){3}\\d+", "127.0.0.1");