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

255
Vistas
how to not allow user to give special characters, numbers , spaces only in first place of word in html using regex

How to not allow user to give special characters, numbers , spaces only in first place of word in html using regex.

<label><span>Current Carrier</span></label>
<input name='Current Carrier'  type='text' class='form-control' pattern='[a-zA-Z]+$' for Physical Address'/>
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can use

pattern="[A-Za-z].*"

Details:

  • The pattern will be compiled into a ^(?:[A-Za-z].*)$ regex pattern that matches an ASCII letter at the start of string and then can contain any zero or more chars other than line break chars, as many as possible, till the end of input string
  • The .* is required because the pattern regex must match the whole input

See the live demo below:

input:valid {
  color: black;
}

input:invalid {
  color: red;
}
<form name="form1">
  <input pattern="[A-Za-z].*" title="Please enter the data in correct format." />
  <input type="Submit" />
</form>

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can try the carrot symbol in regex -> Something like /^[A-Za-z]/ -> this will match the first character and tells that it must be a letter, it cannot be a space, a number or a special character.

You can write the remaining regex after that.

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