Skip to content
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

Bug: Emojis names aren't detected after ambiguous colon matches #104

Open
goodjun opened this issue Jan 1, 2021 · 1 comment
Open

Bug: Emojis names aren't detected after ambiguous colon matches #104

goodjun opened this issue Jan 1, 2021 · 1 comment
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(

Comments

@goodjun
Copy link

goodjun commented Jan 1, 2021

Colon string conversion failure.

like this:

var emoji = require('node-emoji');

var text = emoji.emojify('06:30:sad:')

// text should is '06:30😞', but is '06:30:sad:'
@JoshuaKGoldberg JoshuaKGoldberg changed the title Colon character conversion failure Bug: Emojis names aren't detected after ambiguous colon matches May 20, 2023
@JoshuaKGoldberg JoshuaKGoldberg added type: bug Something isn't working :( status: accepting prs Please, send a pull request to resolve this! labels May 20, 2023
@JoshuaKGoldberg
Copy link
Collaborator

Heh, this is a tricky one. The library detects the :30: as the potential emoji name, and doesn't see the :sad:. This is a behavior of JS regular expressions - they'll skip a match if it overlaps with a previous match in this way:

return input.replace(/:([a-zA-Z0-9_\-+]+):/g, part => {

I think it'd be reasonable to try to also capture for this logic... as long as the implementation doesn't get too complex. And it should probably also work for consecutive overlaps, like 00:06:30:sad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(
Projects
None yet
Development

No branches or pull requests

2 participants