I have some troubles with this small JavaScript code:
var text=\"Z Test Yeah ! Z\"; // With literal syntax, it returns tr
I think it's because you have to escape your backslashes, even when using single quotes. Try this:
new RegExp('Z[\\s\\S]*?Z','g')