I use this regular expression to check if input is float:
[+-]?([0-9]*[.])?[0-9]+
Can I use the same regular expression to check for double?
I use this regular expression to check if input is float:
[+-]?([0-9]*[.])?[0-9]+
Can I use the same regular expression to check for double?
First of all, your regular expression doesn't cover all variants of text representations of a float or double because they also come in scientific form, e.g. 1.2345E15, so you need to change your regex accordingly.
A short googling resulted in this answer on StackOverflow where a better regex is described to be [-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?
(I haven't tested it, though).
To your main question: You can't. There are float and double values that will result into the same text output. What exactly is the reason, why you need this? Personally I try to not use float or double at all due to it's inaccuracies anyway. Maybe there is a completely different solution for what you need.