Safari, @payloadcms/richtext-lexical, Invalid regular expression: invalid group specifier name
Link to reproduction
No response
Payload Version
3.0.0-beta.59
Node Version
v21.6.2
Next.js Version
15.0.0-canary.68
Describe the Bug
Because of the regex at: https://github.com/payloadcms/payload/blob/18645771c86664f1246f0fb599c8265a4cd1d6c0/packages/richtext-lexical/src/field/features/Link/plugins/autoLink/index.tsx#L416
...some pages are broken on safari and script execution stops, it seems to be related to this ongoing safari bug: https://stackoverflow.com/questions/51568821/works-in-chrome-but-breaks-in-safari-invalid-regular-expression-invalid-group
Reproduction Steps
I setup a Payload/NextJS app using the richtext lexical editor. When I visit a page that fetches and displays rich text data, the safari console shows the error in the screenshot above.
Adapters and Plugins
No response
I guess I'm not sure whether the issue is because of the URL_REGEX or the EMAIL_REGEX.
I'm using Safari Version 15.6 (17613.3.9.1.5)
Tried on beta.67 and it is still an issue
Also worth adding, I'm seeing this in a local dev environment. EDIT: it still exists in prod, but it doesn't stop script execution, instead it just shows an unhandled promise error in the console.
Tried on beta.98 and it is still an issue. Admin panel is inaccessible.
This issue has been marked as stale due to lack of activity.
To keep this issue open, please indicate that it is still relevant in a comment below.
This issue was automatically closed due to lack of activity.
This issue should be fixed in Safari 16.4 or later: https://caniuse.com/js-regexp-lookbehind
Closing this issue, as I think it's reasonable to expect users to be able to upgrade to these versions
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.