Skip to content

Commit

Permalink
Propuesta de regexp para nombre y apellido
Browse files Browse the repository at this point in the history
La regexp actual falla a veces porque al parecer valida los campos en unicode, no permitiendo %C3%B1 ("ñ") y caracteres con tilde
  • Loading branch information
gianpietro1 authored Jul 11, 2020
1 parent 103fd99 commit cbf8d6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions culqi-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ function wc_culqi_scripts()
*/
function some_custom_checkout_field_process() {
error_log("[CULQI]...Validando...");
if(preg_match('/^[^0-9±!@£$%^&*_+§¡€#¢§¶•ªº«\\<>?:;|=.,]{2,50}$/', $_POST['billing_first_name'])) {
if(preg_match('/^[a-zA-ZñÑáéíóúÁÉÍÓÚäöüÄÖÜß\s\-]{2,50}$/', $_POST['billing_first_name'])) {
//error_log("Nombre correcto");
} else {
wc_add_notice('Por favor, ingresa un <strong>nombre </strong>válido', 'error' );
}
if(preg_match('/^[^0-9±!@£$%^&*_+§¡€#¢§¶•ªº«\\<>?:;|=.,]{2,50}$/', $_POST['billing_last_name'])) {
if(preg_match('/^[a-zA-ZñÑáéíóúÁÉÍÓÚäöüÄÖÜß\s\-]{2,50}$/', $_POST['billing_last_name'])) {
//error_log("Apellido correcto");
} else {
wc_add_notice('Por favor, ingresa un <strong>apellido </strong>válido.', 'error' );
Expand Down

0 comments on commit cbf8d6d

Please sign in to comment.