0.0.4 • Published 8 years ago

regex-charcode-htmlentities v0.0.4

Weekly downloads
7
License
ISC
Repository
github
Last release
8 years ago

#Regex CharCode HtmlEntities Generator

Inspired by diacritics-regex and htmlentities, create a regex with the term indicated by changing each character for a regex expression with variaves of charCode and Html Entities

var regex = require('regex-charcode-htmlentities')

console.log(regex('maçã'))
/*
/m([AaÀàÁáÂâÃãÄä]|AaÀ|à|Á|á|Â|â|Ã|ã|Ä|ä)
([CcÇç]|CcÇ|ç)([AaÀàÁáÂâÃãÄä]|AaÀ|à|Á|á|Â|â|&Atild
e;|ã|Ä|ä)/i
*/

console.log(regex('maçã','g'))
/*
/m([AaÀàÁáÂâÃãÄä]|AaÀ|à|Á|á|Â|â|Ã|ã|Ä|ä)
([CcÇç]|CcÇ|ç)([AaÀàÁáÂâÃãÄä]|AaÀ|à|Á|á|Â|â|&Atild
e;|ã|Ä|ä)/g
*/

console.log(regex('maçã', false))
/*
m([AaÀàÁáÂâÃãÄä]|AaÀ|à|Á|á|Â|â|Ã|ã|Ä|ä)
([CcÇç]|CcÇ|ç)([AaÀàÁáÂâÃãÄä]|AaÀ|à|Á|á|Â|â|&Atild
e;|ã|Ä|ä)
*/