How to extract all words from a string by multiple delimiters in TypeScript

1 Answer

0 votes
const s = "java,c++.c|python:c#?php=typescript";
 
const arr = s.split(/[\s.|:?,=]+/);
  
for (let i = 0; i < arr.length; i++) {
    console.log(arr[i]);
}
  
  
  
  
/*
run:
  
"java" 
"c++" 
"c" 
"python" 
"c#" 
"php" 
"typescript" 
  
*/

 



answered Apr 11, 2022 by avibootz

Related questions

...