Skip to content

Commit cbf8d6d

Browse files
authored
Propuesta de regexp para nombre y apellido
La regexp actual falla a veces porque al parecer valida los campos en unicode, no permitiendo %C3%B1 ("ñ") y caracteres con tilde
1 parent 103fd99 commit cbf8d6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: culqi-woocommerce.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ function wc_culqi_scripts()
6969
*/
7070
function some_custom_checkout_field_process() {
7171
error_log("[CULQI]...Validando...");
72-
if(preg_match('/^[^0-9±!@£$%^&*_+§¡€#¢§¶•ªº«\\<>?:;|=.,]{2,50}$/', $_POST['billing_first_name'])) {
72+
if(preg_match('/^[a-zA-ZñÑáéíóúÁÉÍÓÚäöüÄÖÜß\s\-]{2,50}$/', $_POST['billing_first_name'])) {
7373
//error_log("Nombre correcto");
7474
} else {
7575
wc_add_notice('Por favor, ingresa un <strong>nombre </strong>válido', 'error' );
7676
}
77-
if(preg_match('/^[^0-9±!@£$%^&*_+§¡€#¢§¶•ªº«\\<>?:;|=.,]{2,50}$/', $_POST['billing_last_name'])) {
77+
if(preg_match('/^[a-zA-ZñÑáéíóúÁÉÍÓÚäöüÄÖÜß\s\-]{2,50}$/', $_POST['billing_last_name'])) {
7878
//error_log("Apellido correcto");
7979
} else {
8080
wc_add_notice('Por favor, ingresa un <strong>apellido </strong>válido.', 'error' );

0 commit comments

Comments
 (0)