I need to match keywords and replace those keywords with <a />
html or <span></span>
tags. Script which i am working on match only single words with no space if i use following regex, \w
text = text.replace(
/([\u0600-\u06ff\w]+)([^\u0600-\u06ff]+)()?/g,
replacer);
and if i use following regex with \s
option then it match all words wrapped withing ASCII such as ,
"
, '
etc.. in fiddle example you will notice it will match all keywords for this from the first paragraphs and which a separated by ,
text2 = text2.replace(
/([\u0600-\u06ff\s]+)([^\u0600-\u06ff]+)()?/g,
replacer);
How can i modify this script so that it works with combinations and match only exact words. I have been working with for few days i tried few option also but non seems to be working, i tried highlight plugin that also had its own issue with arabic. question raised for highlight plugin also here https://stackoverflow.com/questions/29533793/highlighting-of-text-breaks-when-for-either-english-or-arabic
Regex Matching : http://jsfiddle.net/u3k01bfw/13/