Reputation: 596
I've got two strings: "EEFFE" and "EEFFFFFFFFFE", is there any regular expression in java such that when I use split get the following array in both strings?: {"EE","E"}.
Upvotes: 0
Views: 77
Reputation: 463
Alternate solution with a slightly different result:
String a = "EEFFE";
String b = a.replaceAll("F+", "");
Upvotes: 0
Reputation: 8366
The regex you are looking for is just "F+"
.
String[] whatINeed = s.split("F+")
Upvotes: 2