Created
October 3, 2021 18:48
-
-
Save delineas/094b8e953fe32136c8569f151ee88427 to your computer and use it in GitHub Desktop.
Replace text for anchor link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myString = "Comía Feliz el Ñandú cardo y kiwi"; | |
myString.toLowerCase() | |
.normalize('NFD') | |
.replace(/([aeio])\u0301|(u)[\u0301\u0308]/gi,"$1$2") | |
.normalize() | |
.replace(/ñ/gi,"n") | |
.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '') | |
.replace(/ +/g, '-'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment