I am trying to match a numerical value like xx.xx
, xx.x
or x.x
in a string that may be represented with, or without a asterisk.
*10.00
5.0
But not match singular digits
*1
5m
and replace it with a colored version, but my pattern is not matching the whole element in the string, but multiple parts
Here is what I have tried: https://ideone.com/vZwCzh
String string = "*10.00 5.0 *1 5m";
System.out.println(string.replaceAll("([\\*?0-9.]){3,15}", "<span style=\"color:yellow\">$1</span>"));
I get
<span style="color:yellow">0</span> <span style="color:yellow">0</span> *1 5m
Instead of
<span style="color:yellow">*10.00</span> <span style="color:yellow">5.0</span> *1 5m