Regex
See javadoc - uk.gov.gchq.koryphe.impl.predicate.Regex
Available since Koryphe version 1.0.0
Checks if a string matches a pattern
Examples
Regex with pattern
Java
JSON
Full JSON
Python
final Regex function = new Regex("[a-d0-4]");
{
"class" : "Regex",
"value" : {
"java.util.regex.Pattern" : "[a-d0-4]"
}
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.Regex",
"value" : {
"java.util.regex.Pattern" : "[a-d0-4]"
}
}
g.Regex(
value={'java.util.regex.Pattern': '[a-d0-4]'}
)
Input type:
java.lang.String
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | a | true |
java.lang.String | z | false |
java.lang.String | az | false |
java.lang.Character | a | ClassCastException: java.lang.Character cannot be cast to java.lang.String |
java.lang.String | 2 | true |
java.lang.Integer | 2 | ClassCastException: java.lang.Integer cannot be cast to java.lang.String |
java.lang.Long | 2 | ClassCastException: java.lang.Long cannot be cast to java.lang.String |