const regex = /(.*"state":"CA".*"active":true.*)/igm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(.*"state":"CA".*"active":true.*)', 'igm')
const str = `{"id":1,"last":"Doe","first":"John","location":{"city":"San Francisco","state":"CA","postalCode":"94105"},"active":true}
{"id":2,"last":"Dosdsf","first":"Jane","location":{"city":"San Jose","state":"CA","postalCode":"94110"},"active":false}
{"id":3,"last":"Dodsde","first":"Johnathan","location":{"city":"Los Angeles","state":"WA","postalCode":"90045"},"active":true}
{"id":4,"last":"Dhruvil","first":"Darji","location":{"city":"San Francisco","state":"CA","postalCode":"90304"},"active":false}
{"id":5,"last":"Meghal","first":"Gandhi","location":{"city":"Irvine","state":"WA","postalCode":"94155"},"active":true}`;
const subst = ``;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions