This function replaces the first substring matching the given regular expression with the given replacement.
Bash
replaceFirst(text, regex, replacement) #Output : Text
Examples
|
Parser expression |
Description |
|---|---|
|
Bash
|
This example returns: He_lo World |
Additional information
Parameters used in this function
|
Parameter |
Input (data type) |
Description |
|---|---|---|
|
|
text |
Any given text. |
|
|
text |
A valid regular expression that grabs the substring to be replaced. |
|
|
text |
This text will replace the first substring found by the regex. |
Output
This function returns a text
If you want to replace all matching occurrences with the replacement, have a look at the replaceAll() function.
|
Parser expression |
Value |
|---|---|
|
Bash
|
He_lo World |
|
Bash
|
He__o Wor_d |
If you don't want to use a regular expression, have a look at the findReplaceFirst() function.
(books) Use cases and examples
| Use case |
|---|
| No content found. |