Is it a Valid Floating Numeric Character?

Published by BijogFc24 in

Create a regular expression to check whether the given string is a valid floating numeric character or not.

Examples

isFloatingCharacter("12.12") ➞ true

isFloatingCharacter("12.") ➞ false

isFloatingCharacter(".1") ➞ true

isFloatingCharacter("-.1") ➞ true

isFloatingCharacter("abc") ➞ false

Notes

  • All inputs are strings.
  • Think about RegExp.prototype.test().
Watch a quick demo on how Edabit works.