StringRegexReplace
See javadoc - uk.gov.gchq.koryphe.impl.function.StringRegexReplace
Available since Koryphe version 1.9.0
Replace all portions of a string which match a regular expression.
Examples
Replace strings
Java
JSON
Full JSON
Python
final StringRegexReplace function = new StringRegexReplace("[tT]ea", "cake");
{
"class" : "StringRegexReplace",
"regex" : "[tT]ea",
"replacement" : "cake"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.StringRegexReplace",
"regex" : "[tT]ea",
"replacement" : "cake"
}
g.StringRegexReplace(
regex="[tT]ea",
replacement="cake"
)
Input type:
java.lang.String
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.String | tea | java.lang.String | cake |
java.lang.String | Tea | java.lang.String | cake |
java.lang.String | TEA | java.lang.String | TEA |
java.lang.String | brainteaser | java.lang.String | braincakeser |
null | null | ||
java.lang.String | coffee | java.lang.String | coffee |
java.lang.Long | 5 | ClassCastException: java.lang.Long cannot be cast to java.lang.String |