fork download
  1. import java.util.regex.*;
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String regex ="((?:tell me|g(?:et|ive me)|what(?:\\s+i|')s)(?:\\s+the)?\\s+number)";
  11. Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
  12. String text ="what is the number";
  13. Matcher matcher = pattern.matcher(text);
  14. boolean flag= matcher.matches();
  15.  
  16. System.out.println(flag);
  17. }
  18. }
Success #stdin #stdout 0.08s 27816KB
stdin
Standard input is empty
stdout
true