Hello everyone. Could someone help me to figure out how correctly to use regex to split string by 10 letters. So I’ve got long string like this "00101010100000000010001011101000101110100000111111**********00001011110000111111000010111000101110100000111010"
. I need to split this string by 10 letters in order to transfer later letters to morse character. I came with this approach
let str="00101010100000000010001011101000101110100000111111****** 00001011110000111111000010111000101110100000111010"; console.log(str.match(/\d{10}/g));
It splits string by 10, however it omits this symbol *. Could you please help me to figure out, how can I split string and symbol by 10? Thanks in advance for your time!
I also tried this
let str = "00101010100000000010001011101000101110100000111111**** 00001011110000111111000010111000101110100000111010"; console.log(str.match(/^\d{10}\W{10}\d{10}$/g));
But it also doesn’t work((
Also for input there’s always numbers 10 and 11 and 10 asterisks. So I need to split long string consisting of numbers and 10 asterisks by 10, then convert it to Morse character.