Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

250
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda