Use double escaped slashes:
var re = RegExp('^\\d+(?:\\.\\d{0,1})?$');
And it should work.
In JavaScript, you can use literal notation and a constructor. In literal notation (see anubhava's suggestion), you need to add / ... / and then you do not need to escape slashes. When using a RegExp object (a constructor), you must escape backslashes.
Constructor is good when you need to pass variables to your pattern. In other cases, a literal notation is preferrable.
var re = /^\d+(?:\.\d?)?$/;
\d{0,1} is the same as \d? as ? means 0 or 1, greedy.
See more about that difference on MDN.
The literal notation provides compilation of the regular expression
when the expression is evaluated. Use literal notation when the
regular expression will remain constant. For example, if you use
literal notation to construct a regular expression used in a loop, the
regular expression won't be recompiled on each iteration.
The constructor of the regular expression object, for example, new
RegExp('ab+c'), provides runtime compilation of the regular
expression. Use the constructor function when you know the regular
expression pattern will be changing, or you don't know the pattern and
are getting it from another source, such as user input.
When using the constructor function, the normal string escape rules
(preceding special characters with \ when included in a string) are
necessary.