I want to check if my String contains words with a specific length
String s = "ab a abc ac";
if(s.contains(/*any words with 3 or more letters which would be 'abc'*/){
//doSomething
}
Is there a way to do this in regex or with a simple method? Similar to
s.contains("[a-za-za-z]"); //or
s.contains().lettersInARow(3);
What I want is to find these and throw an Error when something longer than 2 characters is found
CodePudding user response:
or with a simple method
String s = "