Safari doesn't support lookbehind #6

Closed
opened 2 years ago by Ghost · 3 comments
Ghost commented 2 years ago

for detecting hastags you use regular expeession

hashtagsRegex = /(?<=[\s>])#(\d*[A-Za-z_]+\d*)\b(?!;)/g,

but Safari doesn't support lookbehind yet (that is, your (?<=[\s>]))

https://caniuse.com/js-regexp-lookbehind

for detecting hastags you use regular expeession ``` hashtagsRegex = /(?<=[\s>])#(\d*[A-Za-z_]+\d*)\b(?!;)/g, ``` but Safari doesn't support lookbehind yet (that is, your (?<=[\s>])) [https://caniuse.com/js-regexp-lookbehind](https://caniuse.com/js-regexp-lookbehind)
KaKi87 commented 2 years ago
Owner

Although I can't remember where I found this regular expression, I must have found it on a specialized forum topic, blog post or similar project, providing some guarantee that it would always work the same way Instagram does and never trigger false positives.

If you shall come up with a viable replacement providing support for Safari web browser while preserving that guarantee, I will change it.

Thanks.

Although I can't remember where I found this regular expression, I must have found it on a specialized forum topic, blog post or similar project, providing some guarantee that it would always work the same way Instagram does and never trigger false positives. If you shall come up with a viable replacement providing support for Safari web browser while preserving that guarantee, I will change it. Thanks.
Ghost commented 2 years ago
Poster

Unfortunately I'm not that good at regex, I tried to find something suitable but could not find

Unfortunately I'm not that good at regex, I tried to find something suitable but could not find
KaKi87 added the
bug
help wanted
labels 2 years ago
KaKi87 commented 2 years ago
Owner

Since the Instagram front-end itself transforms hashtags into links, I'll try to find out if they're either using a regular expression on their front-end, or computing it in the back-end and providing the result through their API.

In any case, I'll try to use replace my own implementation by theirs.

Since the Instagram front-end itself transforms hashtags into links, I'll try to find out if they're either using a regular expression on their front-end, or computing it in the back-end and providing the result through their API. In any case, I'll try to use replace my own implementation by theirs.
KaKi87 closed this issue 2 years ago
This repo is archived. You cannot comment on issues.
No Milestone
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: KaKi87/scraper-instagram-v1#6
Loading…
There is no content yet.