It turns out there's a format jsonc that allows comments like //this in the JSON along other things. In another post, a SO member @tricot develped a regex to remove the comment in python. The question was closed. So here I am trying to produce something positive to SO platform and ask if anyone can produce a json example with //this type of comments that can make the resulting json invalid after applying this regex. comment_re = re.compile( r'//.*|/\*[\s\S]*?\*/|("(\\.|.)*?")', # capture group for quoted strings ) cleaned = comment_re.sub(r'\1', jsonStr) I have this one as the starting point and the regex is working fine. NOTE: I'm not elaborating on having comments in the json is good or bad idea, that's NOT the point. I'm here to verify if this regex has any edge cases not foreseen by this piece of python code. Please ignore /* this type of comments */ as we don't use it in our code. This is an advanced example that shows the regex works //tried this sed -r 's#\s//[^}]*##' // also tried this '%^*3//s39()' [ { "test1" : "http://test.com", "test2" : "http://test.com",//test // any thing "ok" : 3, //here 2 "//networkpath1" : true, //whynot "//networkpath2" : true // ok },//eof { "statement" : "I like test cases" }//eof ] Continue reading...