public static AllMatches allMatches(String regex) {
    return allMatches(Pattern.compile(regex));
  }
@Test
  @Category(NeedsRunner.class)
  public void testAllMatches() {

    PCollection<List<String>> output =
        p.apply(Create.of("a x", "x x", "y y", "z z")).apply(Regex.allMatches("([xyz]) ([xyz])"));

    PAssert.that(output)
        .containsInAnyOrder(
            Arrays.asList("x x", "x", "x"),
            Arrays.asList("y y", "y", "y"),
            Arrays.asList("z z", "z", "z"));
    p.run();
  }