Skip to content

Avoid using lookbehind assertion in regex #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
Yash-Singh1 opened this issue Jun 7, 2025 · 1 comment
Closed
4 tasks done

Avoid using lookbehind assertion in regex #18

Yash-Singh1 opened this issue Jun 7, 2025 · 1 comment
Labels
🤞 phase/open Post is being triaged manually

Comments

@Yash-Singh1
Copy link

Initial checklist

Affected package

mdast-util-gfm-autolink-literal

Steps to reproduce

Currently the email search regex uses a lookbehind assertion, which unfortunately doesn't support older iOS versions <=16 (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Lookbehind_assertion), meaning that users would run into errors with this. I currently patch out this regex, but I thought it would be helpful for others if this package did some workaround to lookbehinds here.

[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, findEmail]

Actual behavior

Lookbehind assertion causes error

Expected behavior

Lookbehind assertion avoided because it doesn't support older iOS

Runtime

iOS/Safari 16

Package manager

N/A

Operating system

N/A

Build and bundle tools

Next.js

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jun 7, 2025
@ChristianMurphy
Copy link
Member

Duplicate of #10

@ChristianMurphy ChristianMurphy marked this as a duplicate of #10 Jun 7, 2025
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤞 phase/open Post is being triaged manually
Development

No branches or pull requests

2 participants