regular-expressions – Regular expression for writing a number in any number system

Question:

Help me write a regular expression to write a number in any number system.

  1. The number can be signed (- or +) or unsigned.
  2. The number can be whole or fractional (, or.)
  3. Valid characters are 0-9, AZ.

I just started to deal with them. Before that, I analyzed everything in the code. But it somehow came out clumsy.


I have a limit – from binary to 36-ary

Answer:

^[-+]?[0-9A-Z]+[.,]?[0-9A-Z]*$
Scroll to Top