klyn.regex.RegEx.replaceFirst
method
public native replaceFirst(input as String, replacement as String) as String:
DescriptionReplaces the first occurrence of the pattern with a replacement string.
regex = RegEx(r"\d+")
result = regex.replaceFirst("123 abc 456", "#") # result will be "# abc 456"
ReturnsThe string after the replacement. ``` regex = RegEx(r"\d+") result = regex.replaceFirst("123 abc 456", "#") # result will be "# abc 456" ```