diacritic-helper

0.0.1 • Public • Published

Diacritic-helper

A small node.js module that helps to find strings containing diacritics with regular expressions. Useful for accentued search in MongoDB.

Installation

$ npm install diacritic-helper

Usage

JS :

var diacriticHelper = require("diacritic-helper");
 
var toFind = "noel";
var txt = "Vive le Père-Noël !";
 
// Without diactric-helper
var result1 = txt.replace(new RegExp("noel","gi"), "Fouettard")
console.log(result1);
 
// With diactric-helper
var result2 = txt.replace(new RegExp(diacriticHelper(toFind),"gi"), "Fouettard")
console.log(result2);

Console output :

Vive le Père-Noël !
Vive le Père-Fouettard !

MIT Licensed

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    29
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    29

Package Sidebar

Install

npm i diacritic-helper

Weekly Downloads

29

Version

0.0.1

License

MIT

Last publish

Collaborators

  • steeve.lefort