Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

101
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda