emoji-java icon indicating copy to clipboard operation
emoji-java copied to clipboard

Capability to ignore parsing emoji aliases inside url links

Open fredericojssilva opened this issue 6 years ago • 4 comments

Description

Taking the following string as example: hello :smiley:. The link is https://link_with_emoji_alias_:smiley:_that_we_do_not_want_to_replace

Currently parsing the above string to unicode will become: hello 😃. The link is https://link_with_emoji_alias_😃_that_we_do_not_want_to_replace

Added a new method parseToUnicode(String input, boolean shouldIgnoreUrls) that will allow us to ignore the parsing inside urls.

The result will be a not broken link: hello 😃. The link is https://link_with_emoji_alias_:smiley:_that_we_do_not_want_to_replace

fredericojssilva avatar Jul 12 '18 17:07 fredericojssilva

Coverage Status

Coverage increased (+0.6%) to 93.842% when pulling 41070c320bfc9cd6f6d31347ae511433d437fbac on fredericojssilva:feature/ignore_alias_inside_urls into 8cf5fbe0d7c1020b926791f2b342a263ed07bb0f on vdurmont:master.

coveralls avatar Jul 12 '18 17:07 coveralls

This looks good!

The URL regex probably won't catch all the cases though. There are many discussions on the regexes for URLs: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url

Maybe we should use a more complete one? What do you think?

vdurmont avatar Jul 12 '18 17:07 vdurmont

@vdurmont agreed. Pushed a more complete one.

fredericojssilva avatar Jul 12 '18 18:07 fredericojssilva

Hey @vdurmont. Have you had a chance to look at it?

fredericojssilva avatar Jul 20 '18 10:07 fredericojssilva