There are lots of posts about regexs to match a potentially empty string, but I couldn\'t readily find any which provided a regex which only matched an emp
The answer may be language dependent, but since you don't mention one, here is what I just came up with in js:
var a = ['1','','2','','3'].join('\n');
console.log(a.match(/^.{0}$/gm)); // ["", ""]
// the "." is for readability. it doesn't really matter
a.match(/^[you can put whatever the hell you want and this will also work just the same]{0}$/gm)
You could also do a.match(/^(.{10,}|.{0})$/gm) to match empty lines OR lines that meet a criteria. (This is what I was looking for to end up here.)
I know that ^ will match the beginning of any line and $ will match the end of any line
This is only true if you have the multiline flag turned on, otherwise it will only match the beginning/end of the string. I'm assuming you know this and are implying that, but wanted to note it here for learners.