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

100
Visualizações
Find word that does not come after word with RegEx

I'm trying to get all the text which start with @ and replace them with the needed text

here's it's regex

/@([a-z_\d]+)/gi

Now the issue I'm facing is I just wanted to get the text if it's alone like

example: hey @hasham my email is vakanihasham@gmail.com

When I run the regex, it should provide me with the @hasham value but not the @gmail. I tried a solution by addingin \s to check empty space before the matching parameter but the issue I'm having is that when the @hasham is first in the paragraph, it doesn't get it because there is no empty space before trying to find a way. How can I simply select the independent words that fit my regex?

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

0

Use a negative lookbehind.

/(?<!\S)@(\w+)/g

This matches @ if it's not preceded by a non-whitespace character.

DEMO

about 4 years ago · Juan Pablo Isaza Relatório

0

You may use this regex with \B (reverse of word boundary):

/\B@(\w+)/g

Updated RegEx Demo

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