-1

I want to avoid characters like "^+%&/!'&(" in the textbox(decimal). What is the correct regular expression?

For instance: Valid: 1,3 or 1,34 or 1
İnvalid: ^4,^' or %2,4 or !!

user2325116
  • 63
  • 1
  • 6

1 Answers1

1

You could try

(\d+[.,])?\d+

This means zero or more digits followed optionally by a decimal point, and then one or more digits.

Edit: Updated to include commas and at least one decimal before the decimal point if the decimal point is present

CorrugatedAir
  • 809
  • 1
  • 6
  • 16