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

260
Vistas
Make exception when replacing diacritics with regular characters

Trying to make an exception to all characters that have been converted to regular letters.

txtValue.normalize('NFD').replace(/[\u0300-\u036f]/g, '');

As you can see, I replace all the special characters for normal letters, but now I would like to add an exception for the char "ç" and it's capital equivalent "Ç", which are u00e7 and u00c7 respectively.

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

0

The only simple way I see is not optimized but do the job properly :

const text = "Çééé éÇé àç" // test this string
  .replace(/\u00e7/g, '__minC__') // save wanted chars position
  .replace(/\u00c7/g, '__majC__')
  .normalize('NFD') // normalize to prepare diacritic edit
  .replace(/\p{Diacritic}/gu, '') // replace all diacritics
  .replace(/__minC__/g, 'ç') // restore wanted chars
  .replace(/__majC__/g, 'Ç')
  
  console.log(text)

In this case we use \p{Diacritic} from Unicode Property Escapes

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