My regex is next
/^(\.\w*)|(\d*\.?\d*)$/
it should works well for float numbers (123.23, 12., .56) and any words that starts from dot.
I was confused when
/^(\.\w*)|(\d*\.?\d*)$/.test("qweasdzxc"); // return true
but without OR:
/^(\.\w*)$/.test("qweasdzxc"); // return false
/^(\d*\.?\d*)$/.test("qweasdzxc"); // return false
On RegexPal all works well
^(\.\w*)and(\d*\.?\d*)$and the latter istrue.