I have written a function in Javascript which highlights words in text using. Takes around 20 lines of code.
highlight(text, pattern)
Here it is: http://jsfiddle.net/sR5wM/1/
Can anyone write a regex that would do the same more efficiently? The highlight function must be case insensitive, and ignore diacritics.
For Example:
highlight("Être ou ne pas être, là est la question", "etre la")
Would yield:
Être ou ne pas être, là est la question