You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Observe that Chrome 49 throws a SyntaxError: Invalid regular expression due to the unsupported lookbehind assertion.
Actual behavior
Chrome 49 throws a syntax error because it does not support the (?<=...) lookbehind assertion used in the regex. This stops the library from correctly parsing autolinked email addresses.
Expected behavior
The regex should be modified to avoid the use of lookbehind assertions (e.g., by using non-capturing groups or an alternative matching strategy) so that it can run in legacy browsers like Chrome 49 without throwing an error. This would improve compatibility and allow users with older browser versions to use the library without issues.
Additional context:
Consider replacing the current regex
Because we treat issues as our backlog, we close duplicates to focus our work and not have to touch the same chunk of code for the same reason multiple times. This is also why we may mark something as duplicate that isn’t an exact duplicate but is closely related.
Hi team! It seems this post is a duplicate, but hasn’t been marked as such. Please post a comment w/ Duplicate of #123(no final .) to do so. See GH docs for more info.
Initial checklist
Affected package
mdast-util-gfm-autolink-literal@latest
Steps to reproduce
Observe that Chrome 49 throws a SyntaxError: Invalid regular expression due to the unsupported lookbehind assertion.
Actual behavior
Chrome 49 throws a syntax error because it does not support the (?<=...) lookbehind assertion used in the regex. This stops the library from correctly parsing autolinked email addresses.
Expected behavior
The regex should be modified to avoid the use of lookbehind assertions (e.g., by using non-capturing groups or an alternative matching strategy) so that it can run in legacy browsers like Chrome 49 without throwing an error. This would improve compatibility and allow users with older browser versions to use the library without issues.
Additional context:
Consider replacing the current regex
/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu
with a version that does not rely on lookbehind assertions, such as:
/(?:^|[\s\p{P}\p{S}])(([-.\w+]+)@([-\w]+(?:\.[-\w]+)+))/gu
Note that the consuming code might need to adjust index access to the matched email address.
Thank you for your consideration and for maintaining this project!
Runtime
Chrome 49.0.2623.100
Package manager
[email protected]
Operating system
window xp
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: