public boolean check(byte[] byteS, int start, int len) {
      for (int i = 0; i < len; i++) {
        byte c = byteS[start + i];
        byte p = byteSub[i];
        switch (p) {
          // For pattern 'd', find digits.
          case 'd':
            if (!('0' <= c && c <= '9')) {
              return false;
            }
            break;
          
          // For other registered patterns, find exact matches.
          case '-':
          case ' ':
          case '(':
          case ')':
            if (c != p) {
              return false;
            }
            break;
          
          // For unregistered patterns, fail.
          default:
            return false;
        }
      }
      return true;
    }
Accepts simple phone number regular expressions consisted only with "\(", "\)", "-", " ", "\d".
For example, it accepts "(\d\d\d) \d\d\d-\d\d\d\d" then matches "(012) 345-6789".
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStringColRegExpStringScalar.java