Skip to content

Avoid using lookbehind assertion in regex #18

Closed as duplicate of#10
Closed as duplicate of#10
@Yash-Singh1

Description

@Yash-Singh1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤞 phase/openPost is being triaged manually

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions