# DeleteEmoji

## Name

Delete Emoji

## Category

Edit

## Notation

- All

## Shortcut

## Code

```pascal
// It works to some extent, but not perfectly.
const
  RE_MAIN =
    '(?:[\x{1F000}-\x{1FAFF}])';

const
  RE_COMPONENTS =
    '(?:' +
      '\x{200D}' + // ZWJ
      '|\x{FE0E}|\x{FE0F}' + // VS15/VS16
      '|[\x{1F3FB}-\x{1F3FF}]' + // skin tone
    ')';

const
  RE_FLAGS =
    '(?:[\x{1F1E6}-\x{1F1FF}]{2})';

const
  RE_KEYCAP =
    '(?:[#*0-9]\x{FE0F}?\x{20E3})';

const
  RE_TAG_FLAGS =
    '(?:\x{1F3F4}[\x{E0020}-\x{E007E}]+\x{E007F})';

const
  RE_BMP_PARTS =
    '(?:' +
      '[\x{2190}-\x{21FF}]' +
      '|[\x{2600}-\x{27BF}]' +
      '|[\x{2B00}-\x{2BFF}]' +
    ')';

const
  RE_OTHER_ARROW =
    '(?:[\x{2934}\x{2935}])';

const
  PATTERN =
    '(?:' +
      RE_TAG_FLAGS + '|' +
      RE_FLAGS + '|' +
      RE_KEYCAP + '|' +
      RE_MAIN + '|' +
      RE_COMPONENTS + '|' +
      RE_BMP_PARTS + '|' +
      RE_OTHER_ARROW +
    ')';

Editor.SelText := RegEx.Replace(Editor.SelText, PATTERN, '', False, False);
```
