public static ZkPathPattern fromString(String pattern) {
    pattern = pattern.trim();
    if (!pattern.startsWith("/")) {
      throw new IllegalArgumentException("ZkPath must start with: '/'. Invalid path: " + pattern);
    }
    if ("/".equals(pattern)) {
      return new ZkPathPattern(singletonList(new Segment("*")));
    }
    List<Segment> segments = new ArrayList<>();
    for (String segment : pattern.substring(1).split("/")) {
      if (segment.isEmpty()) {
        throw new IllegalArgumentException("Invalid ZkPath: " + pattern);
      }
      segments.add(new Segment(segment));
    }
    if (segments.isEmpty()) {
      throw new IllegalArgumentException("Empty ZkPath: " + pattern);
    }
    return new ZkPathPattern(segments);
  }
Creates a instance from a pattern like /*&#47;/abc*
ambari-agent/src/main/java/org/apache/ambari/tools/zk/ZkPathPattern.java