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
find a string with a list of words, a char between them. and the final word can end with any string using regex

I have a list of words:

const words = ["apple", "orange", "tomato"]

const str = "apple.orange.tomato.$COULD_$_BE_ANY_STRING_HERE"

I am looking for the regex to validate this string structure.

  • the string cannot end with "."
  • the string must contain at least one "." char
  • the last string should support the "$" char

some patterns I've tried: ^((apple|orange|tomato)(\\.|$))*$ but it seems to allow the string to end with "." and to not contain a "."

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

0

You can use this expression to start with one of the words at least one followed by dot ^((apple|orange|tomato)\.)+?, then optionally any letter or underscore \w*?, and not end with dot [^\.]$

^((apple|orange|tomato)\.)+?\w*?[^\.]$

TEST

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