I have this Regex :-
let rgb = new RegExp(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
Now, this is working just fine on "rgb( 255 , 0, 255 )"
But I need to write and test this in VS Code, Node.js gives syntax errors when I pass the regex like this, so I'm passing it as a string :
let rgb = new RegExp("rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)");
But this regex isn't validating my string. Need help to use this regex in Node.js