We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Java
- Strings
- Java Regex
- Discussions
Java Regex
Java Regex
Sort by
recency
|
650 Discussions
|
Please Login in order to post a comment
String pattern="^(([01]?([0-9][0-9]?)|2[0-4][0-9]|25[0-5]?)\.){3}([01]?([0-9][0-9]?)|2[0-4][0-9]|25[0-5]?)$";
import java.util.regex.*;
class MyRegex { // Regular expression for validating the IP address String pattern = "^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$"; }
public class Main { public static void main(String[] args) { // Create an instance of MyRegex class MyRegex myRegex = new MyRegex();
}
String pattern = "^(([01]?([0-9][0-9]?)|2[0-4][0-9]|25[0-5]?)\.){3}([01]?([0-9][0-9]?)|2[0-4][0-9]|25[0-5]?)$";
class MyRegex {
}