Last active
January 13, 2017 13:51
-
-
Save keoshi/358237894a5bdbd78a7afe8051ea8917 to your computer and use it in GitHub Desktop.
Neatly separate multiple values
This file contains hidden or 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
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