Both in Actionscript3 and Javascript these statements give the same result:
/\\S/.test(null) => true
/null/.test(null) => true
/m/.test(null) =>
It's not a bug, but you are right, null coerces to 'null' and that behavior is defined on the spec:
RegExp.prototype.exec(string) != nullexec method)."null" when the input is of
type Null.In conclusion, in your examples, the RegExp matchs against the string 'null', so the first non-space character, in this case the letter 'n'.
var a = null+''; // 'null'
/\S/.test(a); // true
(null+'').match(/\S/) // ["n"]