Skip to content

Commit 6b1c5ed

Browse files
committed
Fix issue #5293
1 parent a3c8629 commit 6b1c5ed

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Parse from 'parse/node';
55
// @flow-disable-next
66
import _ from 'lodash';
77
import sql from './sql';
8+
import { XRegExp } = from 'xregexp';
89

910
const PostgresRelationDoesNotExistError = '42P01';
1011
const PostgresDuplicateRelationError = '42P07';
@@ -2438,15 +2439,16 @@ function createLiteralRegex(remaining) {
24382439
return remaining
24392440
.split('')
24402441
.map(c => {
2441-
if (c.match(/[0-9a-zA-Z]/) !== null) {
2442+
const regex = XRegExp('[0-9 ]|\\p{L}'); // Support all unicode letter chars
2443+
if (c.match(regex) !== null) {
24422444
// don't escape alphanumeric characters
24432445
return c;
24442446
}
24452447
// escape everything else (single quotes with single quotes, everything else with a backslash)
24462448
return c === `'` ? `''` : `\\${c}`;
24472449
})
24482450
.join('');
2449-
}
2451+
}
24502452

24512453
function literalizeRegexPart(s: string) {
24522454
const matcher1 = /\\Q((?!\\E).*)\\E$/;

0 commit comments

Comments
 (0)