Java Regular Expression to match a line that doesn't contain a word.

Java Programming Java8Object Oriented Programming

public class RegTest {
   public static void main(String[] args) {
      // TODO Auto-generated method stub
      String s="tutorials";
      boolean i=s.matches("^((?!kk).)*$");
      System.out.println(i);
   }
   returns true, if word does not match character kk
}
raja
Published on 22-Jun-2018 12:16:20
Advertisements