Answers for "java chec if string is a regex"

0

use regex in if statement java

Pattern p = Pattern.compile("a*b");
 Matcher m = p.matcher("aaaaab");
 boolean b = m.matches();
Posted by: Guest on June-24-2020
0

Valid regex check java

try{
     Pattern.compile(pattern);
     System.out.println("Valid");
   }
catch(PatternSyntaxException e)
   {
     System.out.println("Invalid");
   }
Posted by: Guest on February-08-2022

Code answers related to "java chec if string is a regex"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language