Here are the validations which I want to apply:

1. The string should contain any character between 0 to 9.
2. It should not contain any alphabetical character.
3. It can contain at most one '-' (minus operator) which will signify a negative number such as "-12".
4. It can also contain at most one '.' to cover the case of floating numbers such as "12.2"

Now I have tried various combinations but still I am unsuccessful to create such a condition in Typescript.
Here's what I tried:

* **using regex** /^[0-9.{0,1}-{0,1}]/.test(mystring)

Unfortunately, this didn't work for me.
Can anyone please help me to get the desired solution?