OnJava8-Examples/strings/Rudolph.java

16 lines
288 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// strings/Rudolph.java
2015-06-15 17:47:35 -07:00
public class Rudolph {
public static void main(String[] args) {
for(String pattern : new String[]{ "Rudolph",
"[rR]udolph", "[rR][aeiou][a-z]ol.*", "R.*" })
System.out.println("Rudolph".matches(pattern));
}
2015-09-07 11:44:36 -06:00
}
/* Output:
2015-06-15 17:47:35 -07:00
true
true
true
true
2015-09-07 11:44:36 -06:00
*/