Skip to content

Instantly share code, notes, and snippets.

@2014maximo
Last active May 27, 2024 18:01
Show Gist options
  • Save 2014maximo/019a8e416a05212b1bfb5a03a586dda6 to your computer and use it in GitHub Desktop.
Save 2014maximo/019a8e416a05212b1bfb5a03a586dda6 to your computer and use it in GitHub Desktop.
Expresiones regulares para formularios reactivos
//VALIDAR CAMPO IP 255.255.255.255
Validators.pattern(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/)
//VALIDAD SOLO NÚMEROS
Validators.pattern(/^([0-9])*$/),//solo numeros
//VALIDAD CAMPO REQUERIDO
Validators.required,
//VALIDA TELEFONO
Validators.minLength(7),
Validators.maxLength(10),
Validators.pattern(/^([0-9])*$/),
//VALIDA CAMPO NOMBRE
Validators.minLength(2),
Validators.maxLength(30),
Validators.pattern(/^[A-Za-z\s\xF1\xD1]+$/)//solo letra
//VALIDA CORREO - EMAIL
Validators.pattern(/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/),//correo debe tner @ y .com
@JohnArevaloRodriguez
Copy link

Muchas gracias amigo, has salvado una vida

@bely092
Copy link

bely092 commented Jun 4, 2023

Gracias por el Aporte!

@jhons1206
Copy link

Gracias estimado! me fue de mucha utilidad para mi proyecto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment