Postgres: Regex support foreign characters (#5598)
* Fix issue #5293 * Fix issue #5293 * add test * Revert "add test" This reverts commit 38b32a627a9d2c9a9b852b48194f173d8b7254f3. * fix conflicts * use native package
This commit is contained in:
committed by
Diamond Lewis
parent
b178d5ca6a
commit
ad7fc48c97
1633
package-lock.json
generated
1633
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4638,6 +4638,19 @@ describe('Parse.Query testing', () => {
|
||||
equal(results[0].get('array'), data2);
|
||||
});
|
||||
|
||||
it('can query regex with unicode', async () => {
|
||||
const object = new TestObject();
|
||||
object.set('field', 'autoöo');
|
||||
await object.save();
|
||||
|
||||
const query = new Parse.Query(TestObject);
|
||||
query.contains('field', 'autoöo');
|
||||
const results = await query.find();
|
||||
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('field')).toBe('autoöo');
|
||||
});
|
||||
|
||||
it('can update mixed array more than 100 elements', async () => {
|
||||
const array = [0, 1.1, 'hello world', { foo: 'bar' }, null];
|
||||
const obj = new TestObject({ array });
|
||||
|
||||
@@ -2441,7 +2441,8 @@ function createLiteralRegex(remaining) {
|
||||
return remaining
|
||||
.split('')
|
||||
.map(c => {
|
||||
if (c.match(/[0-9a-zA-Z]/) !== null) {
|
||||
const regex = RegExp('[0-9 ]|\\p{L}', 'u'); // Support all unicode letter chars
|
||||
if (c.match(regex) !== null) {
|
||||
// don't escape alphanumeric characters
|
||||
return c;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user