code: @Nonnull
    public static Pattern string2pattern(@Nonnull final String text, final int patternFlags) {
      final StringBuilder result = new StringBuilder();
  
      for (final char c : text.toCharArray()) {
        result.append("\\u"); //NOI18N
        final String code = Integer.toHexString(c).toUpperCase(Locale.ENGLISH);
        result.append("0000", 0, 4 - code.length()).append(code); //NOI18N
      }
  
      return Pattern.compile(result.toString(), patternFlags);
    }
docs: Create pattern from string.
  
  @param text text to be converted into pattern.
  @param patternFlags flags to be used
  @return formed pattern