Skip to content

'๐Ÿ‡ฉ๐Ÿ‡ฐ๐Ÿ‡ฒ๐Ÿ‡ฌ'.replace('๐Ÿ‡ฐ๐Ÿ‡ฒ', '๐Ÿ‡ช๐Ÿ‡จ'); // โ†’ '๐Ÿ‡ฉ๐Ÿ‡ช๐Ÿ‡จ๐Ÿ‡ฌ'

Notifications You must be signed in to change notification settings

mathiasbynens/flag-emoji-replacements

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Interesting flag emoji replacements

@iwsfutcmd shared an interesting observation:

'๐Ÿ‡ง๐Ÿ‡ฌ๐Ÿ‡ญ๐Ÿ‡ท'.replace('๐Ÿ‡ฌ๐Ÿ‡ญ', '๐Ÿ‡ฆ๐Ÿ‡ฌ'); // โ†’ '๐Ÿ‡ง๐Ÿ‡ฆ๐Ÿ‡ฌ๐Ÿ‡ท'

This repository contains every possible variation of this gotcha according to Unicode 15.1.0โ€™s RGI_Emoji_Flag_Sequence. Thereโ€™s 9,211,570 different variations clocking in at 718.53 MB, so the output is split across multiple files.

Examples:

'๐Ÿ‡ป๐Ÿ‡ฆ๐Ÿ‡ฉ๐Ÿ‡ฒ'.replace('๐Ÿ‡ฆ๐Ÿ‡ฉ', '๐Ÿ‡ฌ๐Ÿ‡บ'); // โ†’ '๐Ÿ‡ป๐Ÿ‡ฌ๐Ÿ‡บ๐Ÿ‡ฒ'
'๐Ÿ‡ฐ๐Ÿ‡ท๐Ÿ‡ช๐Ÿ‡น'.replace('๐Ÿ‡ท๐Ÿ‡ช', '๐Ÿ‡ณ๐Ÿ‡ฑ'); // โ†’ '๐Ÿ‡ฐ๐Ÿ‡ณ๐Ÿ‡ฑ๐Ÿ‡น'
'๐Ÿ‡จ๐Ÿ‡ต๐Ÿ‡ธ๐Ÿ‡จ'.replace('๐Ÿ‡ต๐Ÿ‡ธ', '๐Ÿ‡ป๐Ÿ‡จ'); // โ†’ '๐Ÿ‡จ๐Ÿ‡ป๐Ÿ‡จ๐Ÿ‡จ'
'๐Ÿ‡ง๐Ÿ‡ง๐Ÿ‡ธ๐Ÿ‡ฑ'.replace('๐Ÿ‡ง๐Ÿ‡ธ', '๐Ÿ‡ช๐Ÿ‡ฌ'); // โ†’ '๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ฌ๐Ÿ‡ฑ'
'๐Ÿ‡ฆ๐Ÿ‡น๐Ÿ‡จ๐Ÿ‡บ'.replace('๐Ÿ‡น๐Ÿ‡จ', '๐Ÿ‡ธ๐Ÿ‡ฒ'); // โ†’ '๐Ÿ‡ฆ๐Ÿ‡ธ๐Ÿ‡ฒ๐Ÿ‡บ'
'๐Ÿ‡ฌ๐Ÿ‡ฑ๐Ÿ‡ฆ๐Ÿ‡ช'.replace('๐Ÿ‡ฑ๐Ÿ‡ฆ', '๐Ÿ‡ฎ๐Ÿ‡ช'); // โ†’ '๐Ÿ‡ฌ๐Ÿ‡ฎ๐Ÿ‡ช๐Ÿ‡ช'
'๐Ÿ‡ฑ๐Ÿ‡ธ๐Ÿ‡ฒ๐Ÿ‡ญ'.replace('๐Ÿ‡ธ๐Ÿ‡ฒ', '๐Ÿ‡ฐ๐Ÿ‡ช'); // โ†’ '๐Ÿ‡ฑ๐Ÿ‡ฐ๐Ÿ‡ช๐Ÿ‡ญ'
'๐Ÿ‡น๐Ÿ‡ป๐Ÿ‡ฆ๐Ÿ‡ซ'.replace('๐Ÿ‡ป๐Ÿ‡ฆ', '๐Ÿ‡จ๐Ÿ‡ฌ'); // โ†’ '๐Ÿ‡น๐Ÿ‡จ๐Ÿ‡ฌ๐Ÿ‡ซ'
'๐Ÿ‡ฌ๐Ÿ‡ญ๐Ÿ‡ท๐Ÿ‡บ'.replace('๐Ÿ‡ญ๐Ÿ‡ท', '๐Ÿ‡ธ๐Ÿ‡ญ'); // โ†’ '๐Ÿ‡ฌ๐Ÿ‡ธ๐Ÿ‡ญ๐Ÿ‡บ'
'๐Ÿ‡ฆ๐Ÿ‡ฌ๐Ÿ‡ซ๐Ÿ‡ฎ'.replace('๐Ÿ‡ฌ๐Ÿ‡ซ', '๐Ÿ‡ฑ๐Ÿ‡ธ'); // โ†’ '๐Ÿ‡ฆ๐Ÿ‡ฑ๐Ÿ‡ธ๐Ÿ‡ฎ'
'๐Ÿ‡ฌ๐Ÿ‡ธ๐Ÿ‡ฎ๐Ÿ‡น'.replace('๐Ÿ‡ธ๐Ÿ‡ฎ', '๐Ÿ‡น๐Ÿ‡ฑ'); // โ†’ '๐Ÿ‡ฌ๐Ÿ‡น๐Ÿ‡ฑ๐Ÿ‡น'
'๐Ÿ‡ฌ๐Ÿ‡ฎ๐Ÿ‡ธ๐Ÿ‡ฌ'.replace('๐Ÿ‡ฎ๐Ÿ‡ธ', '๐Ÿ‡ง๐Ÿ‡ง'); // โ†’ '๐Ÿ‡ฌ๐Ÿ‡ง๐Ÿ‡ง๐Ÿ‡ฌ'
'๐Ÿ‡น๐Ÿ‡น๐Ÿ‡ฒ๐Ÿ‡ฆ'.replace('๐Ÿ‡น๐Ÿ‡ฒ', '๐Ÿ‡ฌ๐Ÿ‡น'); // โ†’ '๐Ÿ‡น๐Ÿ‡ฌ๐Ÿ‡น๐Ÿ‡ฆ'
'๐Ÿ‡ฌ๐Ÿ‡ผ๐Ÿ‡ซ๐Ÿ‡ฒ'.replace('๐Ÿ‡ผ๐Ÿ‡ซ', '๐Ÿ‡ง๐Ÿ‡ฏ'); // โ†’ '๐Ÿ‡ฌ๐Ÿ‡ง๐Ÿ‡ฏ๐Ÿ‡ฒ'
'๐Ÿ‡จ๐Ÿ‡ฐ๐Ÿ‡ฌ๐Ÿ‡ฆ'.replace('๐Ÿ‡ฐ๐Ÿ‡ฌ', '๐Ÿ‡ฒ๐Ÿ‡จ'); // โ†’ '๐Ÿ‡จ๐Ÿ‡ฒ๐Ÿ‡จ๐Ÿ‡ฆ'
'๐Ÿ‡ฒ๐Ÿ‡ณ๐Ÿ‡ฆ๐Ÿ‡ด'.replace('๐Ÿ‡ณ๐Ÿ‡ฆ', '๐Ÿ‡ซ๐Ÿ‡ฎ'); // โ†’ '๐Ÿ‡ฒ๐Ÿ‡ซ๐Ÿ‡ฎ๐Ÿ‡ด'
'๐Ÿ‡ช๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡จ'.replace('๐Ÿ‡ฆ๐Ÿ‡ฎ', '๐Ÿ‡ญ๐Ÿ‡ฒ'); // โ†’ '๐Ÿ‡ช๐Ÿ‡ญ๐Ÿ‡ฒ๐Ÿ‡จ'
'๐Ÿ‡ฎ๐Ÿ‡น๐Ÿ‡น๐Ÿ‡ญ'.replace('๐Ÿ‡น๐Ÿ‡น', '๐Ÿ‡ณ๐Ÿ‡ช'); // โ†’ '๐Ÿ‡ฎ๐Ÿ‡ณ๐Ÿ‡ช๐Ÿ‡ญ'
'๐Ÿ‡ต๐Ÿ‡ฌ๐Ÿ‡บ๐Ÿ‡ฌ'.replace('๐Ÿ‡ฌ๐Ÿ‡บ', '๐Ÿ‡ฒ๐Ÿ‡ฌ'); // โ†’ '๐Ÿ‡ต๐Ÿ‡ฒ๐Ÿ‡ฌ๐Ÿ‡ฌ'
'๐Ÿ‡ฑ๐Ÿ‡ธ๐Ÿ‡ธ๐Ÿ‡ฝ'.replace('๐Ÿ‡ธ๐Ÿ‡ธ', '๐Ÿ‡ฐ๐Ÿ‡ฒ'); // โ†’ '๐Ÿ‡ฑ๐Ÿ‡ฐ๐Ÿ‡ฒ๐Ÿ‡ฝ'
'๐Ÿ‡บ๐Ÿ‡พ๐Ÿ‡น๐Ÿ‡ป'.replace('๐Ÿ‡พ๐Ÿ‡น', '๐Ÿ‡ฒ๐Ÿ‡ฒ'); // โ†’ '๐Ÿ‡บ๐Ÿ‡ฒ๐Ÿ‡ฒ๐Ÿ‡ป'
'๐Ÿ‡ธ๐Ÿ‡ช๐Ÿ‡น๐Ÿ‡ฉ'.replace('๐Ÿ‡ช๐Ÿ‡น', '๐Ÿ‡ฑ๐Ÿ‡จ'); // โ†’ '๐Ÿ‡ธ๐Ÿ‡ฑ๐Ÿ‡จ๐Ÿ‡ฉ'
'๐Ÿ‡ฌ๐Ÿ‡ช๐Ÿ‡ธ๐Ÿ‡ญ'.replace('๐Ÿ‡ช๐Ÿ‡ธ', '๐Ÿ‡ธ๐Ÿ‡น'); // โ†’ '๐Ÿ‡ฌ๐Ÿ‡ธ๐Ÿ‡น๐Ÿ‡ญ'
'๐Ÿ‡ธ๐Ÿ‡ฉ๐Ÿ‡ฒ๐Ÿ‡ฌ'.replace('๐Ÿ‡ฉ๐Ÿ‡ฒ', '๐Ÿ‡ฌ๐Ÿ‡ช'); // โ†’ '๐Ÿ‡ธ๐Ÿ‡ฌ๐Ÿ‡ช๐Ÿ‡ฌ'
'๐Ÿ‡ธ๐Ÿ‡ฒ๐Ÿ‡ฆ๐Ÿ‡ฎ'.replace('๐Ÿ‡ฒ๐Ÿ‡ฆ', '๐Ÿ‡ง๐Ÿ‡ณ'); // โ†’ '๐Ÿ‡ธ๐Ÿ‡ง๐Ÿ‡ณ๐Ÿ‡ฎ'

To get a random example:

shuf -n 1 < output/$(ls output/ | shuf -n 1)

The general pattern is the following, where A, B, C, D, E, and F are all flag emoji, and {A, B} are distinct from {C, D, E, F}:

'AB'.replace('C', 'D'); // โ†’ 'EF'

Note that {C, D} may overlap with {E, F}, as that leads to even more confusing results, e.g.:

'๐Ÿ‡ฒ๐Ÿ‡ฆ๐Ÿ‡ธ๐Ÿ‡ฑ'.replace('๐Ÿ‡ฆ๐Ÿ‡ธ', '๐Ÿ‡ฒ๐Ÿ‡ฒ'); // โ†’ '๐Ÿ‡ฒ๐Ÿ‡ฒ๐Ÿ‡ฒ๐Ÿ‡ฑ'

Explanation

Unicode defines the following 26 Regional_Indicator symbols:

๐Ÿ‡ฆ ๐Ÿ‡ง ๐Ÿ‡จ ๐Ÿ‡ฉ ๐Ÿ‡ช ๐Ÿ‡ซ ๐Ÿ‡ฌ ๐Ÿ‡ญ ๐Ÿ‡ฎ ๐Ÿ‡ฏ ๐Ÿ‡ฐ ๐Ÿ‡ฑ ๐Ÿ‡ฒ ๐Ÿ‡ณ ๐Ÿ‡ด ๐Ÿ‡ต ๐Ÿ‡ถ ๐Ÿ‡ท ๐Ÿ‡ธ ๐Ÿ‡น ๐Ÿ‡บ ๐Ÿ‡ป ๐Ÿ‡ผ ๐Ÿ‡ฝ ๐Ÿ‡พ ๐Ÿ‡ฟ

Combining two of these into a country code results in the flag emoji for that country. So, @iwsfutcmdโ€™s example:

'๐Ÿ‡ง๐Ÿ‡ฌ๐Ÿ‡ญ๐Ÿ‡ท'.replace('๐Ÿ‡ฌ๐Ÿ‡ญ', '๐Ÿ‡ฆ๐Ÿ‡ฌ'); // โ†’ '๐Ÿ‡ง๐Ÿ‡ฆ๐Ÿ‡ฌ๐Ÿ‡ท'

โ€ฆis actually the following (with spaces added for clarity):

'๐Ÿ‡ง ๐Ÿ‡ฌ ๐Ÿ‡ญ ๐Ÿ‡ท'.replace('๐Ÿ‡ฌ ๐Ÿ‡ญ', '๐Ÿ‡ฆ ๐Ÿ‡ฌ'); // โ†’ '๐Ÿ‡ง ๐Ÿ‡ฆ ๐Ÿ‡ฌ ๐Ÿ‡ท'

The code replaces the second half (๐Ÿ‡ฌ) of the first flag emoji (๐Ÿ‡ง๐Ÿ‡ฌ) and the first half (๐Ÿ‡ญ) of the second flag emoji (๐Ÿ‡ญ๐Ÿ‡ท), thus changing both the first and second emoji.

About

'๐Ÿ‡ฉ๐Ÿ‡ฐ๐Ÿ‡ฒ๐Ÿ‡ฌ'.replace('๐Ÿ‡ฐ๐Ÿ‡ฒ', '๐Ÿ‡ช๐Ÿ‡จ'); // โ†’ '๐Ÿ‡ฉ๐Ÿ‡ช๐Ÿ‡จ๐Ÿ‡ฌ'

Topics

Resources

Stars

Watchers

Forks