title: Filter out multiple emojis from Unicode text in Python
body: <p>Let's say we have following strings containing emojis:</p>
  
  <pre><code>sent1 = '  right'
  sent2 = 'Some text?! '
  sent3 = ''
  </code></pre>
  
  <p>The task is to remove text and get the following output:</p>
  
  <pre><code>sent1_emojis = '  '
  sent2_emojis = ' '
  sent3_emojis = '' 
  </code></pre>
  
  <p>Based on past question (<a href="https://stackoverflow.com/q/48945826/8201676">Regex Emoji Unicode</a>) I use the following regex to identify strings that contain at least one emoji:</p>
  
  <pre><code>emoji_pattern = re.compile(u".*(["
  u"\U0001F600-\U0001F64F"  # emoticons
  u"\U0001F300-\U0001F5FF"  # symbols &amp; pictographs
  u"\U0001F680-\U0001F6FF"  # transport &amp; map symbols
  u"\U0001F1E0-\U0001F1FF"  # flags (iOS)
                  "])+", flags= re.UNICODE)
  </code></pre>
  
  <p>In order to get the output string I use the following:</p>
  
  <pre><code>re.match(emoji_pattern, sent1).group(0)
  </code></pre>
  
  <p>and so on.</p>
  
  <p>There's a problem with the <code>sent2</code> string. <code>re.match(emoji_pattern, sent1).group(0)</code> returns the whole <code>sent2</code> instead of emojis only.</p>