Java String replaceFirst() method

tutorial and example
tutorial and example

This method replace the first substring with user specified String.

Syntax:

Parameter:

Regexp : Regular Expression

Replacement : the String which would replace found expression

Return: a string

Java String replaceFirst() Example 1

Output:

Java String replaceFirst() Example 2

Output:

Java String replaceFirst() Example 3

Output:

Return Value :

Welcome to tutorialandexample.com

Java String replaceFirst() Example 4

Output: