Hi
I am trying to highlight a number of keywords using javascript and a regular expression, I ran into one problem, my keyword may contain literals and special characters, like in @text #number, etc. I use the word boundary to match and replace the whole word and not a partial word (contained in another word).
var pattern = new regular expression ('\ b' (+ keyword + ') \ b', gi); here this expression matches all keywords and selects them, however, if there werenβt any keyword selected, for example, βnumber:β,
I know that \ bword \ b matches the word boundary, and special characters are not alphanumeric characters, so they do not match the expression above.
Can you tell me which regular expression I can use to accomplish the above.
thanks,
Bhupen
source share