Status
Tech review

Style guide




Short description

Replaces only the first substring matching the given regular expression with the given replacement.

Output

Available since




This function replaces the first substring matching the givenĀ regular expression with the given replacement.


replaceFirst(text, regexp, replacement) #Output : Text



Parser expressionDescription


replaceFirst("Hello World", "l", "_")


The function returns a text : "He_lo World"



Parameters used in this function

ParameterInput (data type)Description
text

Any given text.
regexp

A valid regeular expression that grabs the substring to be replaced.
replacement

This text will replace the substring found by the regexp.



This function returns a


If you want to replace all matching occurrences with the replacement, have a look at theĀ replaceAll() function.

replaceFirst("Hello World", "l", "_")replaceAll("Hello World", "l", "_")
"He_lo World""He__o World"