الجمعة، 20 ديسمبر 2013

How to replace only IP in url string in file

You will first need to read the files content. Then you could use a regular expression that matches the ip address (e.g. \d+\.\d+\.\d+\.\d+) and replace it with the new one. When you've done that write it back in the file again.

Here is a regex tester: http://www.regexplanet.com/advanced/java/index.html

Here a tutorial of how to read and write files: http://www.java-samples.com/showtutorial.php?tutorialid=392


View the original article here

ليست هناك تعليقات:

إرسال تعليق