Need to match and replace all first occurrences of plus alone with %2b
Example
Input Output
++123++ %2b%2b123++
+++++12 %2b%2b%2b%2b%2b12
12 12
123+ 123+
+1 %2b1
+2 %2b2
How to do this via regex? It is possible to do via character matching in java but wanted to see whether it is possible via regex pattern?
System.out.println("+++123".replaceFirst("\\+", "%2b")); ==> Just removes the first character alone