Invalid regular expression error in Safari
vpotter opened this issue · 11 comments
Version: 3.8.2
Error: SyntaxError: Invalid regular expression: invalid group specifier name
The error is caused by a look-behind regex assertion which is not supported by Safari (according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#browser_compatibility)
The error is reproducible on both desktop & mobile.
Can someone find a regex that works with safari and suggest it here?
@jpic Any development on this?
I've read the comment, but since I've never used django-nested-admin I'm not sure I get it right.
What type of id's you'd like to exclude among the following:
100-empty-200
x-empty-y
test100-empty-1test
foo-100-empty-200-bar
What if we simpy check it like this: https://regex101.com/r/R8FLpq/1 ?
Or 2 expressions one to check if there no match for <digits>-empty-<digits>
AND there is match for -empty-
It breaks Safari for us as well :(
but I reverting to 3.8.1 - it is good with safari
If I understand the comments right:
-empty-
should returnfalse
-foo-empty-bar-
should returnfalse
-1-empty-2-
should returntrue
-foo-bar-
should returntrue
// return !this.id.match(/(?<!-\d+)-empty-(?!\d+-)/);
return !this.id.match(/-empty-/) || this.id.match(/-\d+-empty-\d+-/);
-empty-
matches the left side, is negated by the!
, and fails to match the right side, so the whole expression isfalse
-foo-empty-bar-
matches the left side, is negated by the!
, and fails to match the right side, so again,false
-1-empty-2-
matches the left side, is negated by the!
, and then does match the right side, so the whole expression istrue
-foo-bar-
doesn't match the left side, so gets negated totrue
by the!
, and the expression shortcircuits returningtrue
I replaced the Ajax version from 3.8.1 to resolve the issue
Any chance that a new version will be released soon to PyPI with this fix included?
At the moment DAL is non-functional in Safari browsers (both desktop and mobile) for me.
Sure, anyone can confirm the current master is working in production for them?
It works for me!
(Safari 14.1 on macOS, and whatever the latest Safari is on iOS)