I want a regular expression that will accept only floating point numbers from 0 to 9 and minus sign.
Please help.
Try ^[-+]?[0-9]*[.,]?[0-9]+$.
This regular expression will match an optional sign, that is either followed by zero or more digits followed by a dot and one or more digits (a floating point number with optional integer part), or followed by one or more digits (an integer).
Source: http://www.regular-expressions.info/floatingpoint.html - altered to work with commas as decimal separator