The regex is constructed on the fly, but I've output it to firebug:
(.{1,38})(+|$\n?)
the error is
invalid quantifier +|$\n?)
I don't even know what invalid quantifier means! I really feel like I'm going to get the "Show us something relevant" answer, but I'm not sure where to start.
The actual code is:
var re = top.RegExp;
var regex = new re("(.{1," + len + "})(+|$\\n?)", "gm");
UPDATE: Per Bennor McCarthy's instructions, I changed the code to this:
var regex = new re("(.{1," + len + "})(\+|\$\\n?)", "gm");
Firebug still tells me this:
invalid quantifier +|$\n?)
[Break on this error] var regex = new re("(.{1," + len + "})(\+|\$\\n?)", "gm");
ANOTHER UPDATE Looks Like I had to double slash it and this solved the problem!
final code
var regex = new re("(.{1," + len + "})(\\+|\\$\\n?)", "gm");