我想知道如何将正则表达式更改为 / ^ email。* /
我遇到困难,您能帮我吗?
// Retrieve all apis from the database.
exports.findAllPasswords = (req, res) => {
const password = req.query.password;
var condition = password ? { password: { $regex: new RegExp(password), $options: "i" } } : {};
if (!password)
res.json({ message: "Password param missing!" });
api.find(condition)
.then(data => {
res.send(data);
})
.catch(err => {
res.status(500).send({
message:
err.message || "Some error occurred while retrieving apis."
});
});
};