String.replaceFirst()

Signature

String replaceFirst (String s1, String regex, String replacement)

Domain

action, condition

Description

Replaces the first substring of this string that matches the given regular expression with the given replacement.

Parameters

NameTypeDescription
s1StringA String to replace characters in.
regexStringThe regular expression to which the String s1 is to be matched.
replacementStringA String to replace regular expression matches with.

Returns

TypeDescription
StringA string derived from the String s1 by replacing every occurrence of the regular expression with replacement.

Cautions

none

See Also

java.util.regex.Pattern