function splitString(s: string, delims: string): string[] {
const re: RegExp = new RegExp(delims);
const parts: string[] = s.split(re);
return parts.filter(t => t.length > 0);
}
const s: string = '-c, c++.. c#:: -java ,php...python go';
const delims: string = "[ ,.:\\-!]+";
const tokens: string[] = splitString(s, delims);
for (const t of tokens) {
console.log(t);
}
/*
run:
c
c++
c#
java
php
python
go
*/