Theory and Practice
About Archives Categories Tags Authors 中文 ไทย

[JavaScript] Wrap Pāli Words in Span Element

April 02, 2016
Edit on Github

Wrap Pāli words in span element via regular expression and JavaScript.

function markInSpan(htmlString) {
  return string.replace(/[AaBbCcDdEeGgHhIiJjKkLlMmNnOoPpRrSsTtUuVvYyĀāĪīŪūṀṁṂṃŊŋṆṇṄṅÑñṬṭḌḍḶḷ]+/g, '<span>$&</span>');
}

References:

[1]javascript string replace

Author: Siong-Ui Te
∈ Category: JavaScript
∑ Tags: JavaScript , html , Regular Expression , String Manipulation
Powered by Github Pages, Pelican, pyScss.