Regular expression quantifiers in java

Quantifiers are used to replace how many times a character is present in the String

String alphaNumeric = "abcdeee1234545";
replaces anything that starts with(^) abcd and has 3 es i.e abcdeee
System.out.println(alphaNumeric.replaceAll("^abcde{3}", "X"));

+ means atleast one character.

Below code replaces anything that starts with(^) abcd and has n number of e s i.e 1 or more es.So + means we need atleast one e.
System.out.println(alphaNumeric.replaceAll("^abcde+", "X"));
  alphaNumeric = "abcdkfgfgf1234545";

* is used to replace 0 or more character and not 1 or more characters as we have seen with +/ So below code will match anything that starts with abcd and contains anything after that i.e can contain 0 e or 1 e or 2 e or anything else as well.So below expression will also replace with X even if 0 e is present i.e if String jusr starts with abcd the replaceAll will still match

System.out.println(alphaNumeric.replaceAll("^abcde*", "X"));
 alphaNumeric = "abcdeeeee1234545";

To replace anything that starts with abcd and then 2 to 5 es

System.out.println(alphaNumeric.replaceAll("^abcde{2,5}", "X"));