surround hebrew text and english text in div

I am trying to add span around hebrew sentence and english sentence in paragraph
“so היי all whats up אתכם?”
will become :

[span]so[/span][span]היי[/span][span]all whats up[/span][span]אתכם[/span]

been trying with regexp but its just removing the hebrew words and joining the english words in one span

var str = 'so היי all whats up אתכם?'
var match= str.match(/(b[a-z]+b)/ig);
var replace = match.join().replace(match.join(),'<span>'+match.join()+'</span>')

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.