Skip to content

Instantly share code, notes, and snippets.

View carloslato's full-sized avatar
🎯
Focusing

Carlos La Torre carloslato

🎯
Focusing
View GitHub Profile
@JiveDig
JiveDig / class-woocommerce-product-taxonomy-import-export.php
Last active October 5, 2024 13:55
WooCommerce Product Taxonomy Import/Export. Makes it easy to add custom taxonomies to built in WooCommerce import/export feature.
<?php
// Prevent direct file access.
defined( 'ABSPATH' ) || die;
/**
* The main plugin class.
*
* @version 0.1.0
*
@PecceG2
PecceG2 / Validar Dni
Last active October 28, 2024 13:56 — forked from jvinceso/Validar Dni
Validar Numero de Dni Solo Numeros y longitud 7-8 mediante expresiones regulares en Javascript (Fork: Soporta símbolos y acepta de 7 a 8 caracteres para personas mayores)
function validaDNI(dni){
onlyNumbersDNI = dni.toString().replace(/\D/g, '');
let ex_regular_dni = /^\d{7,8}(?:[-\s]\d{4})?$/;
if(ex_regular_dni.test(onlyNumbersDNI) == true && !(/[a-zA-Z]/g.test(dni)) && onlyNumbersDNI === dni.replace(/(\d)[\s.]+(?=\d)/g, '$1')){
alert('Dni corresponde');
return true;
}else{
alert('Dni erroneo, formato no válido');
return false;
}