Regex.MatchesNameKV (Apache Beam 2.32.0-SNAPSHOT)
Regex.MatchesNameKV<KV<String, String>>
takes a PCollection<String>
and returnsa
PCollection<KV<String, String>>
representing the key and value extracted from theRegex groups of the input
PCollection
to the number of times that element occurs in theinput.
This transform runs a Regex on the entire input line. If the entire line does not match the
Regex, the line will not be output. If it does match the entire line, the groups in the Regex
will be used. The key will be the key’s group and the value will be the value’s group.
Example of use:
PCollection<String> words = ...;
PCollection<KV<String, String>> keysAndValues =
words.apply(Regex.matchesKV("myregex (?<keyname>mykeygroup) (?<valuename>myvaluegroup)",
"keyname", "valuename"));
Read more here: Source link