can anyone help me understand this line code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

can anyone help me understand this line code?

import java.util.*; public class test { public static void main(String[] args) { System.out.println(validate("216.08.094.196")); System.out.println(validate("08.008.0008.00008")); System.out.println(validate("01.102.103.104")); } public static String validate(String ip) { //i am not getting reg ex return statement . explain plz. return ip.replaceAll("(?<=^|\\.)0+(?!\\.|$)",""); } }

2nd Jul 2022, 1:02 PM
Shashi Singh
Shashi Singh - avatar
1 Answer
+ 3
I know that Solomoni Railoa, Ipang, Minho 🇰🇷, A͢J and Jayakrishna🇮🇳 are pretty nifty with java. Perhaps they can help.
2nd Jul 2022, 1:38 PM
Ausgrindtube
Ausgrindtube - avatar