I need to split only month names from a string .
Ex :
let str = "januaryfebruaryapriltuesdayfriday";
I want to split like
let arr = ["january","february"," april "]
I am new to JS , I have tried split method ,but i didn't get the result ,is there anyway to do this ?
You could use a regular expression for searching for month names and get an array of it.
var string = "januaryfebruaryapriltuesdayfriday",
array = string.match(/january|february|march|april|may|june|july|august|september|october|november|december/gi);
console.log(array);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With