MultiRegex
See javadoc - uk.gov.gchq.koryphe.impl.predicate.MultiRegex
Available since Koryphe version 1.0.0
Checks if a string matches at least one pattern
Examples
Multi regex with pattern
Java
JSON
Full JSON
Python
final MultiRegex function = new MultiRegex(new Pattern[]{Pattern.compile("[a-d]"), Pattern.compile("[0-4]")});
{
"class" : "MultiRegex",
"value" : [ {
"java.util.regex.Pattern" : "[a-d]"
}, {
"java.util.regex.Pattern" : "[0-4]"
} ]
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.MultiRegex",
"value" : [ {
"java.util.regex.Pattern" : "[a-d]"
}, {
"java.util.regex.Pattern" : "[0-4]"
} ]
}
g.MultiRegex(
value=[
{'java.util.regex.Pattern': '[a-d]'},
{'java.util.regex.Pattern': '[0-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 |