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

Feature: allow search to take in a RegExp #105

Open
sloanlance opened this issue Feb 10, 2021 · 1 comment
Open

Feature: allow search to take in a RegExp #105

sloanlance opened this issue Feb 10, 2021 · 1 comment
Labels
good first issue Good for newcomers, please hop on! status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request

Comments

@sloanlance
Copy link

sloanlance commented Feb 10, 2021

Change emoji.search() to return emoji whose name contains the search string. I can imagine two approaches:

  1. Always treat the argument as a substring. E.g., emoji.search('evil') β†’ [{ key: 'see_no_evil', emoji: 'πŸ™ˆ' }, { key: 'see_no_evil', emoji: 'πŸ™ˆ' }, { key: 'see_no_evil', emoji: 'πŸ™ˆ' }]. (Example results not exhaustive.)
    • This is probably easiest and most lightweight to implement, but is not backwards compatible with old code that uses this library.
  2. Allow standard regular expressions in the argument. E.g., emoji.search('.*evil') β†’ [{ key: 'see_no_evil', emoji: 'πŸ™ˆ' }, { key: 'see_no_evil', emoji: 'πŸ™ˆ' }, { key: 'see_no_evil', emoji: 'πŸ™ˆ' }]. (Example results not exhaustive.)
    • This may be more complicated, but it will be backwards compatible and it won't return unexpected results.
@Richienb
Copy link
Collaborator

Richienb commented Feb 11, 2021

Always treat the argument as a substring

I think that is the current behaviour.

Allow standard regular expressions in the argument

We could allow RegExp objects to be passed that are evaluated for each emoji.

@JoshuaKGoldberg JoshuaKGoldberg changed the title allow substring search Feature: allow search to take in a RegExp May 20, 2023
@JoshuaKGoldberg JoshuaKGoldberg added type: feature New enhancement or request status: accepting prs Please, send a pull request to resolve this! good first issue Good for newcomers, please hop on! labels May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers, please hop on! status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request
Projects
None yet
Development

No branches or pull requests

3 participants