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

171
Visualizações
What type of regex would I need to grab from data

What regex would I need to get <t:1583277337:R> to then replace it so it display the proper information (in this case: 3 Years ago)

Why? I'm trying to use it on Discord where Discord automatically converts <t:1583277337:R> to the corresponding data, but the API retrieved data (below) doesnt automatically convert on Discord Embeds

Data

"bio": "𝖓𝖔𝖙 𝖊𝖛𝖊𝖗𝖞𝖔𝖓𝖊 𝖜𝖎𝖑𝖑 𝖇𝖊𝖑𝖎𝖊𝖛𝖊 𝖎𝖓 𝖞𝖔𝖚, 𝖇𝖚𝖙 𝖓𝖔𝖙 𝖊𝖛𝖊𝖗𝖞𝖔𝖓𝖊 𝖒𝖆𝖙𝖙𝖊𝖗𝖘...\n\n\n<t:1583277337:R> <3"
almost 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I won't give you the full solution, but here is the logic:

  1. explicit regex match for an <t:, in sequence
  2. digits of any amount
  3. explicit regex match for :R>

You can use this regex in String#replace. The replace method can accept a callback as its second argument for a more powerful parsing of a match. In this case, you can process the string in the replace callback to whatever text you need

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#parameters

almost 4 years ago · Santiago Trujillo Relatório

0

Example with group name:

<t:(?<timestamp>\d*):R>

Try it here https://regex101.com/

almost 4 years ago · Santiago Trujillo 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