balderdashy/sails-mongo — pull request #91 by etiennetremel (2014-01-30 04:12:34+00:00)
Title: Regexp flag causing issue with line break

Hi everyone,

I added the g flag to the regular expression used for any **where request** using the **contains** or **like** attribute.

When doing a request like the following one. Assuming a long text containing line breaks is defined for each content field, this doesn't work. Without my fix, this only works if the field doesn't contain any line break (\n).

```javascript
var q = req.param('query');
Post.find({
content: {
contains: q
}
}, function (err, posts) {
if (err) { return res.view('index', {posts: {}}); }
return res.view({posts: posts});
});
```

Cheers.