I have a string that I want to make sure that the format is always a +
followed by digits.
The following would work:
String parsed = input
Yes you can use this kind of replacement:
String parsed = inputString.replaceAll("^[^0-9+]*(\\+)|[^0-9]+", "$1");
if present and before the first digit in the string, the +
character is captured in group 1. For example: dfd+sdfd12+sdf12
returns +1212
(the second +
is removed since its position is after the first digit).