public class Regex
extends java.lang.Object
PTransorm
s to use Regular Expressions to process elements in a PCollection
.
matches(String, int)
can be used to see if an entire line matches a Regex.
matchesKV(String, int, int)
can be used to see if an entire line matches a Regex
and output certain groups as a KV
.
find(String, int)
can be used to see if a portion of a line matches a Regex.
matchesKV(String, int, int)
can be used to see if a portion of a line matches a
Regex and output certain groups as a KV
.
Lines that do not match the Regex will not be output.
Modifier and Type | Class and Description |
---|---|
static class |
Regex.AllMatches
Regex.MatchesName<String> takes a PCollection<String> and returns a PCollection<List<String>> representing the value extracted from all the
Regex groups of the input
PCollection to the number of times that element occurs in the input. |
static class |
Regex.Find
Regex.Find<String> takes a PCollection<String> and returns a PCollection<String> representing the value extracted from the Regex groups of the input PCollection to the number of times that element occurs in the input. |
static class |
Regex.FindAll
Regex.Find<String> takes a PCollection<String> and returns a PCollection<List<String>> representing the value extracted from the
Regex groups of the input PCollection to the number of times that element occurs in the input. |
static class |
Regex.FindKV
Regex.MatchesKV<KV<String, String>> takes a PCollection<String> and returns a
PCollection<KV<String, String>> representing the key and value extracted from the Regex
groups of the input PCollection to the number of times that element occurs in the
input. |
static class |
Regex.FindName
Regex.Find<String> takes a PCollection<String> and returns a PCollection<String> representing the value extracted from the Regex groups of the input PCollection to the number of times that element occurs in the input. |
static class |
Regex.FindNameKV
Regex.MatchesKV<KV<String, String>> takes a PCollection<String> and returns a
PCollection<KV<String, String>> representing the key and value extracted from the Regex
groups of the input PCollection to the number of times that element occurs in the
input. |
static class |
Regex.Matches
Regex.Matches<String> takes a PCollection<String> and returns a PCollection<String> representing the value extracted from the Regex groups of the input PCollection to the number of times that element occurs in the input. |
static class |
Regex.MatchesKV
Regex.MatchesKV<KV<String, String>> takes a PCollection<String> and returns a
PCollection<KV<String, String>> representing the key and value extracted from the Regex
groups of the input PCollection to the number of times that element occurs in the
input. |
static class |
Regex.MatchesName
Regex.MatchesName<String> takes a PCollection<String> and returns a PCollection<String> representing the value extracted from the Regex groups of the input PCollection to the number of times that element occurs in the input. |
static class |
Regex.MatchesNameKV
Regex.MatchesNameKV<KV<String, String>> takes a PCollection<String> and returns
a PCollection<KV<String, String>> representing the key and value extracted from the
Regex groups of the input PCollection to the number of times that element occurs in the
input. |
static class |
Regex.ReplaceAll
Regex.ReplaceAll<String> takes a PCollection<String> and returns a PCollection<String> with all Strings that matched the Regex being replaced with the
replacement string. |
static class |
Regex.ReplaceFirst
Regex.ReplaceFirst<String> takes a PCollection<String> and returns a PCollection<String> with the first Strings that matched the Regex being replaced with the
replacement string. |
static class |
Regex.Split
Regex.Split<String> takes a PCollection<String> and returns a PCollection<String> with the input string split into individual items in a list. |
Modifier and Type | Method and Description |
---|---|
static Regex.AllMatches |
allMatches(java.util.regex.Pattern pattern)
Returns a
Regex.AllMatches PTransform that checks if the entire line matches
the Regex. |
static Regex.AllMatches |
allMatches(java.lang.String regex)
Returns a
Regex.AllMatches PTransform that checks if the entire line matches
the Regex. |
static Regex.Find |
find(java.util.regex.Pattern pattern)
Returns a
Regex.Find PTransform that checks if a portion of the line matches
the Regex. |
static Regex.Find |
find(java.util.regex.Pattern pattern,
int group)
Returns a
Regex.Find PTransform that checks if a portion of the line matches
the Regex. |
static Regex.FindName |
find(java.util.regex.Pattern pattern,
java.lang.String groupName)
Returns a
Regex.FindName PTransform that checks if a portion of the line
matches the Regex. |
static Regex.Find |
find(java.lang.String regex)
Returns a
Regex.Find PTransform that checks if a portion of the line matches
the Regex. |
static Regex.Find |
find(java.lang.String regex,
int group)
Returns a
Regex.Find PTransform that checks if a portion of the line matches
the Regex. |
static Regex.FindName |
find(java.lang.String regex,
java.lang.String groupName)
Returns a
Regex.FindName PTransform that checks if a portion of the line
matches the Regex. |
static Regex.FindAll |
findAll(java.util.regex.Pattern pattern)
Returns a
Regex.FindAll PTransform that checks if a portion of the line matches
the Regex. |
static Regex.FindAll |
findAll(java.lang.String regex)
Returns a
Regex.FindAll PTransform that checks if a portion of the line matches
the Regex. |
static Regex.FindKV |
findKV(java.util.regex.Pattern pattern,
int keyGroup,
int valueGroup)
Returns a
Regex.FindKV PTransform that checks if a portion of the line matches
the Regex. |
static Regex.FindNameKV |
findKV(java.util.regex.Pattern pattern,
java.lang.String keyGroupName,
java.lang.String valueGroupName)
Returns a
Regex.FindNameKV PTransform that checks if a portion of the line
matches the Regex. |
static Regex.FindKV |
findKV(java.lang.String regex,
int keyGroup,
int valueGroup)
Returns a
Regex.FindKV PTransform that checks if a portion of the line matches
the Regex. |
static Regex.FindNameKV |
findKV(java.lang.String regex,
java.lang.String keyGroupName,
java.lang.String valueGroupName)
Returns a
Regex.FindNameKV PTransform that checks if a portion of the line
matches the Regex. |
static Regex.Matches |
matches(java.util.regex.Pattern pattern)
Returns a
Regex.Matches PTransform that checks if the entire line matches the
Regex. |
static Regex.Matches |
matches(java.util.regex.Pattern pattern,
int group)
Returns a
Regex.Matches PTransform that checks if the entire line matches the
Regex. |
static Regex.MatchesName |
matches(java.util.regex.Pattern pattern,
java.lang.String groupName)
Returns a
Regex.MatchesName PTransform that checks if the entire line matches
the Regex. |
static Regex.Matches |
matches(java.lang.String regex)
Returns a
Regex.Matches PTransform that checks if the entire line matches the
Regex. |
static Regex.Matches |
matches(java.lang.String regex,
int group)
Returns a
Regex.Matches PTransform that checks if the entire line matches the
Regex. |
static Regex.MatchesName |
matches(java.lang.String regex,
java.lang.String groupName)
Returns a
Regex.MatchesName PTransform that checks if the entire line matches
the Regex. |
static Regex.MatchesKV |
matchesKV(java.util.regex.Pattern pattern,
int keyGroup,
int valueGroup)
Returns a
Regex.MatchesKV PTransform that checks if the entire line matches the
Regex. |
static Regex.MatchesNameKV |
matchesKV(java.util.regex.Pattern pattern,
java.lang.String keyGroupName,
java.lang.String valueGroupName)
Returns a
Regex.MatchesNameKV PTransform that checks if the entire line matches
the Regex. |
static Regex.MatchesKV |
matchesKV(java.lang.String regex,
int keyGroup,
int valueGroup)
Returns a
Regex.MatchesKV PTransform that checks if the entire line matches the
Regex. |
static Regex.MatchesNameKV |
matchesKV(java.lang.String regex,
java.lang.String keyGroupName,
java.lang.String valueGroupName)
Returns a
Regex.MatchesNameKV PTransform that checks if the entire line matches
the Regex. |
static Regex.ReplaceAll |
replaceAll(java.util.regex.Pattern pattern,
java.lang.String replacement)
Returns a
Regex.ReplaceAll PTransform that checks if a portion of the line
matches the Regex and replaces all matches with the replacement String. |
static Regex.ReplaceAll |
replaceAll(java.lang.String regex,
java.lang.String replacement)
Returns a
Regex.ReplaceAll PTransform that checks if a portion of the line
matches the Regex and replaces all matches with the replacement String. |
static Regex.ReplaceFirst |
replaceFirst(java.util.regex.Pattern pattern,
java.lang.String replacement)
Returns a
Regex.ReplaceAll PTransform that checks if a portion of the line
matches the Regex and replaces the first match with the replacement String. |
static Regex.ReplaceFirst |
replaceFirst(java.lang.String regex,
java.lang.String replacement)
Returns a
Regex.ReplaceAll PTransform that checks if a portion of the line
matches the Regex and replaces the first match with the replacement String. |
static Regex.Split |
split(java.util.regex.Pattern pattern)
Returns a
Regex.Split PTransform that splits a string on the regular expression
and then outputs each item. |
static Regex.Split |
split(java.util.regex.Pattern pattern,
boolean outputEmpty)
Returns a
Regex.Split PTransform that splits a string on the regular expression
and then outputs each item. |
static Regex.Split |
split(java.lang.String regex)
Returns a
Regex.Split PTransform that splits a string on the regular expression
and then outputs each item. |
static Regex.Split |
split(java.lang.String regex,
boolean outputEmpty)
Returns a
Regex.Split PTransform that splits a string on the regular expression
and then outputs each item. |
public static Regex.Matches matches(java.lang.String regex)
Regex.Matches
PTransform
that checks if the entire line matches the
Regex. Returns the entire line (group 0) as a PCollection
.regex
- The regular expression to runpublic static Regex.Matches matches(java.util.regex.Pattern pattern)
Regex.Matches
PTransform
that checks if the entire line matches the
Regex. Returns the entire line (group 0) as a PCollection
.pattern
- The regular expression to runpublic static Regex.Matches matches(java.lang.String regex, int group)
Regex.Matches
PTransform
that checks if the entire line matches the
Regex. Returns the group as a PCollection
.regex
- The regular expression to rungroup
- The Regex group to return as a PCollectionpublic static Regex.Matches matches(java.util.regex.Pattern pattern, int group)
Regex.Matches
PTransform
that checks if the entire line matches the
Regex. Returns the group as a PCollection
.pattern
- The regular expression to rungroup
- The Regex group to return as a PCollectionpublic static Regex.MatchesName matches(java.lang.String regex, java.lang.String groupName)
Regex.MatchesName
PTransform
that checks if the entire line matches
the Regex. Returns the group as a PCollection
.regex
- The regular expression to rungroupName
- The Regex group name to return as a PCollectionpublic static Regex.MatchesName matches(java.util.regex.Pattern pattern, java.lang.String groupName)
Regex.MatchesName
PTransform
that checks if the entire line matches
the Regex. Returns the group as a PCollection
.pattern
- The regular expression to rungroupName
- The Regex group name to return as a PCollectionpublic static Regex.AllMatches allMatches(java.lang.String regex)
Regex.AllMatches
PTransform
that checks if the entire line matches
the Regex. Returns all groups as a List<String> in a PCollection
.regex
- The regular expression to runpublic static Regex.AllMatches allMatches(java.util.regex.Pattern pattern)
Regex.AllMatches
PTransform
that checks if the entire line matches
the Regex. Returns all groups as a List<String> in a PCollection
.pattern
- The regular expression to runpublic static Regex.MatchesKV matchesKV(java.lang.String regex, int keyGroup, int valueGroup)
Regex.MatchesKV
PTransform
that checks if the entire line matches the
Regex. Returns the specified groups as the key and value as a PCollection
.regex
- The regular expression to runkeyGroup
- The Regex group to use as the keyvalueGroup
- The Regex group to use the valuepublic static Regex.MatchesKV matchesKV(java.util.regex.Pattern pattern, int keyGroup, int valueGroup)
Regex.MatchesKV
PTransform
that checks if the entire line matches the
Regex. Returns the specified groups as the key and value as a PCollection
.pattern
- The regular expression to runkeyGroup
- The Regex group to use as the keyvalueGroup
- The Regex group to use the valuepublic static Regex.MatchesNameKV matchesKV(java.lang.String regex, java.lang.String keyGroupName, java.lang.String valueGroupName)
Regex.MatchesNameKV
PTransform
that checks if the entire line matches
the Regex. Returns the specified groups as the key and value as a PCollection
.regex
- The regular expression to runkeyGroupName
- The Regex group name to use as the keyvalueGroupName
- The Regex group name to use the valuepublic static Regex.MatchesNameKV matchesKV(java.util.regex.Pattern pattern, java.lang.String keyGroupName, java.lang.String valueGroupName)
Regex.MatchesNameKV
PTransform
that checks if the entire line matches
the Regex. Returns the specified groups as the key and value as a PCollection
.pattern
- The regular expression to runkeyGroupName
- The Regex group name to use as the keyvalueGroupName
- The Regex group name to use the valuepublic static Regex.Find find(java.lang.String regex)
Regex.Find
PTransform
that checks if a portion of the line matches
the Regex. Returns the entire line (group 0) as a PCollection
.regex
- The regular expression to runpublic static Regex.Find find(java.util.regex.Pattern pattern)
Regex.Find
PTransform
that checks if a portion of the line matches
the Regex. Returns the entire line (group 0) as a PCollection
.pattern
- The regular expression to runpublic static Regex.Find find(java.lang.String regex, int group)
Regex.Find
PTransform
that checks if a portion of the line matches
the Regex. Returns the group as a PCollection
.regex
- The regular expression to rungroup
- The Regex group to return as a PCollectionpublic static Regex.Find find(java.util.regex.Pattern pattern, int group)
Regex.Find
PTransform
that checks if a portion of the line matches
the Regex. Returns the group as a PCollection
.pattern
- The regular expression to rungroup
- The Regex group to return as a PCollectionpublic static Regex.FindName find(java.lang.String regex, java.lang.String groupName)
Regex.FindName
PTransform
that checks if a portion of the line
matches the Regex. Returns the group as a PCollection
.regex
- The regular expression to rungroupName
- The Regex group name to return as a PCollectionpublic static Regex.FindName find(java.util.regex.Pattern pattern, java.lang.String groupName)
Regex.FindName
PTransform
that checks if a portion of the line
matches the Regex. Returns the group as a PCollection
.pattern
- The regular expression to rungroupName
- The Regex group name to return as a PCollectionpublic static Regex.FindAll findAll(java.lang.String regex)
Regex.FindAll
PTransform
that checks if a portion of the line matches
the Regex. Returns all the groups as a List<String> in a PCollection
.regex
- The regular expression to runpublic static Regex.FindAll findAll(java.util.regex.Pattern pattern)
Regex.FindAll
PTransform
that checks if a portion of the line matches
the Regex. Returns all the groups as a List<String> in a PCollection
.pattern
- The regular expression to runpublic static Regex.FindKV findKV(java.lang.String regex, int keyGroup, int valueGroup)
Regex.FindKV
PTransform
that checks if a portion of the line matches
the Regex. Returns the specified groups as the key and value as a PCollection
.regex
- The regular expression to runkeyGroup
- The Regex group to use as the keyvalueGroup
- The Regex group to use the valuepublic static Regex.FindKV findKV(java.util.regex.Pattern pattern, int keyGroup, int valueGroup)
Regex.FindKV
PTransform
that checks if a portion of the line matches
the Regex. Returns the specified groups as the key and value as a PCollection
.pattern
- The regular expression to runkeyGroup
- The Regex group to use as the keyvalueGroup
- The Regex group to use the valuepublic static Regex.FindNameKV findKV(java.lang.String regex, java.lang.String keyGroupName, java.lang.String valueGroupName)
Regex.FindNameKV
PTransform
that checks if a portion of the line
matches the Regex. Returns the specified groups as the key and value as a PCollection
.regex
- The regular expression to runkeyGroupName
- The Regex group name to use as the keyvalueGroupName
- The Regex group name to use the valuepublic static Regex.FindNameKV findKV(java.util.regex.Pattern pattern, java.lang.String keyGroupName, java.lang.String valueGroupName)
Regex.FindNameKV
PTransform
that checks if a portion of the line
matches the Regex. Returns the specified groups as the key and value as a PCollection
.pattern
- The regular expression to runkeyGroupName
- The Regex group name to use as the keyvalueGroupName
- The Regex group name to use the valuepublic static Regex.ReplaceAll replaceAll(java.lang.String regex, java.lang.String replacement)
Regex.ReplaceAll
PTransform
that checks if a portion of the line
matches the Regex and replaces all matches with the replacement String. Returns the group as a
PCollection
.regex
- The regular expression to runreplacement
- The string to be substituted for each matchpublic static Regex.ReplaceAll replaceAll(java.util.regex.Pattern pattern, java.lang.String replacement)
Regex.ReplaceAll
PTransform
that checks if a portion of the line
matches the Regex and replaces all matches with the replacement String. Returns the group as a
PCollection
.pattern
- The regular expression to runreplacement
- The string to be substituted for each matchpublic static Regex.ReplaceFirst replaceFirst(java.lang.String regex, java.lang.String replacement)
Regex.ReplaceAll
PTransform
that checks if a portion of the line
matches the Regex and replaces the first match with the replacement String. Returns the group
as a PCollection
.regex
- The regular expression to runreplacement
- The string to be substituted for each matchpublic static Regex.ReplaceFirst replaceFirst(java.util.regex.Pattern pattern, java.lang.String replacement)
Regex.ReplaceAll
PTransform
that checks if a portion of the line
matches the Regex and replaces the first match with the replacement String. Returns the group
as a PCollection
.pattern
- The regular expression to runreplacement
- The string to be substituted for each matchpublic static Regex.Split split(java.lang.String regex)
Regex.Split
PTransform
that splits a string on the regular expression
and then outputs each item. It will not output empty items. Returns the group as a PCollection
. a PCollection
.regex
- The regular expression to runpublic static Regex.Split split(java.util.regex.Pattern pattern)
Regex.Split
PTransform
that splits a string on the regular expression
and then outputs each item. It will not output empty items. Returns the group as a PCollection
. a PCollection
.pattern
- The regular expression to runpublic static Regex.Split split(java.lang.String regex, boolean outputEmpty)
Regex.Split
PTransform
that splits a string on the regular expression
and then outputs each item. Returns the group as a PCollection
.regex
- The regular expression to runoutputEmpty
- Should empty be output. True to output empties and false if not.public static Regex.Split split(java.util.regex.Pattern pattern, boolean outputEmpty)
Regex.Split
PTransform
that splits a string on the regular expression
and then outputs each item. Returns the group as a PCollection
.pattern
- The regular expression to runoutputEmpty
- Should empty be output. True to output empties and false if not.