I have this regular expression:
/@import\s*;/g
What I'm trying to do is to replace all the occurrences of @import "blablabla";
by zeros or whitespaces in a string.
I tried using the replace()
method this way:
"@import 'file.css';".replace(/@import\s*;/g, "0");
But it doesn't work because it replaces each occurrence by one zero. For example, I wanna replace @import 'file.css';
by 0000000000000000000
, and not by 0
. Not that @import 'file.css';
can be @import 'file.css';
. So, you can't know the length of the string.
Is there any fast way to do this?