Javatpoint Logo
Javatpoint Logo

Java String replaceAll()

The java string replaceAll() method returns a string replacing all the sequence of characters matching regex and replacement string.


Internal implementation


Signature


Parameters

regex : regular expression

replacement : replacement sequence of characters


Returns

replaced string


Java String replaceAll() example: replace character

Let's see an example to replace all the occurrences of a single character.

Test it Now
jevetpoint is e very good website

Java String replaceAll() example: replace word

Let's see an example to replace all the occurrences of single word or set of words.

Test it Now
My name was Khan. My name was Bob. My name was Sonoo.

Java String replaceAll() example: remove white spaces

Let's see an example to remove all the occurrences of white spaces.

Test it Now
MynameisKhan.MynameisBob.MynameisSonoo.

Click me to know about regex






Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA