Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions spec/ParseQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,16 @@ describe('Parse.Query testing', () => {
.then(done);
});

it_id('351f57a8-e00a-4da2-887d-6e25c9e359fc')(it)('regex with unicode option', async function () {
const thing = new TestObject();
thing.set('myString', 'hello 世界');
await Parse.Object.saveAll([thing]);
const query = new Parse.Query(TestObject);
query.matches('myString', '世界', 'u');
const results = await query.find();
equal(results.length, 1);
});

it_id('823852f6-1de5-45ba-a2b9-ed952fcc6012')(it)('Use a regex that requires all modifiers', function (done) {
const thing = new TestObject();
thing.set('myString', 'PArSe\nCom');
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const validateQuery = (
Object.keys(query).forEach(key => {
if (query && query[key] && query[key].$regex) {
if (typeof query[key].$options === 'string') {
if (!query[key].$options.match(/^[imxs]+$/)) {
if (!query[key].$options.match(/^[imxsu]+$/)) {
throw new Parse.Error(
Parse.Error.INVALID_QUERY,
`Bad $options value for query: ${query[key].$options}`
Expand Down
Loading