Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

237
Visualizações
Why telegram emoji numbers are not deleted when removing special characters

I have a telegram bot and I want to remove all special characters and just returns numbers and A-Z,but the problem is that my regex pattern can remove any emojies except numbers like this :1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣

I want to delete emoji numbers too

So this is my pattern :

text = '1️⃣Hi =) 1.This regex removes 2️⃣all special 6️⃣characters like this !@$#%^&*()_+=~`/\><.⚠️4️⃣'

text.toUpperCase().match(/[a-z]+|\d+(?:\.\d+)?/gi)
    .map((m) => (isNaN(m) ? m : +m))

//Current output : 
// [1,'HI',1,'THIS','REGEX','REMOVES',2,'ALL', 'SPECIAL',6,'CHARACTERS', 'LIKE','THIS']


//What I want : 
// ['HI',1,'THIS','REGEX','REMOVES','ALL', 'SPECIAL','CHARACTERS', 'LIKE','THIS']

Also I don't know why it removed the last number emoji from string! (4️⃣)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

These numbers are emojis. To remove them, too, use the following:

text = '1️⃣Hi =) 1.This regex removes 2️⃣all special 6️⃣characters like this !@$#%^&*()_+=~`/\><.⚠️4️⃣'

console.log(
  text.toUpperCase().match(/[a-z]+|(?!\d\uFE0F\u20E3)\d+(?:\.\d+)?/gi)
    .map((m) => (isNaN(m) ? m : +m))
)

The (?!\d\uFE0F\u20E3) negative lookahead will fail any match of \d+(?:\.\d+)? when the first digit is a part of the numeric emojis.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda