function getRegExp(node){if(node.value instanceof RegExp){return node.value;}else if(typeof node.value==="string"){var parent=context.getAncestors().pop();if((parent.type==="NewExpression"||parent.type==="CallExpression")&&parent.callee.type==="Identifier"&&parent.callee.name==="RegExp"){// there could be an invalid regular expression string
try{return new RegExp(node.value);}catch(ex){return null;}}}return null;}
Get the regex expression
@param {ASTNode} node node to evaluate
@returns {*} Regex if found else null
@private