Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahmut-gundogdu/f447db110c15e611d0977f09e41e58c6 to your computer and use it in GitHub Desktop.
Save mahmut-gundogdu/f447db110c15e611d0977f09e41e58c6 to your computer and use it in GitHub Desktop.
regex ile aranan cumleyi & bosluk gibi karakterlerden temizleyip arayan regex paterni
var param= "mahmut gundogdu";//diye arayınca mahmut gundogdu da mahmut gundogdu da mahmut&gundogdu da gelecek. gelmeli.
param = param.replace(/([^a-z|0-9]){1,}/ig, ('([^a-z|0-9]){1,}'))
var rx = new RegExp(param, "i")
var isMatched = item.match(rx);
if (isMatched) {
return item;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment