Skip to content

Instantly share code, notes, and snippets.

@keoshi
Last active January 13, 2017 13:51
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 keoshi/358237894a5bdbd78a7afe8051ea8917 to your computer and use it in GitHub Desktop.
Save keoshi/358237894a5bdbd78a7afe8051ea8917 to your computer and use it in GitHub Desktop.
Neatly separate multiple values
var altNames = "cena cena3;cena2; cena4 ;cena5; ;;cena6.cena7";
// 1. Split with space, dot or semicolon
// 2. Filter out empty values
var debug = altNames.split(/[ .;]+/).filter(Boolean);
console.log( debug );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment