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

154
Vistas
Need help figuring out how to write this Regex properly

I am trying to make a regex test that returns true for the following conditions:

  • Can only have letters A-F (case insensitive)
  • First character must be '#'
  • Can have numbers 0-9
  • Does not have punctuation

The order does not matter except that string[0] should be '#'.

So far I have: /^#[A-F0-9^!G-Z]/i but for some reason, it returns strings that have letters after F (like G or J) as true.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use

^#[0-9A-Fa-f]*$

Details:

  • ^ - start of string
  • # - a hash symbol
  • [0-9A-Fa-f]* - zero or more hex chars (note it can be written as [[:xdigit:]]* in some regex flavors, but not in ECMAScript flavor used in JavaScript)
  • $ - end of string.
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