This looks overcomplicated. Such complicated bracket nesting can cause measurable performance problems in some regex engines (especially Firefox). Also it seems it doesn't fit the description of the method.

If only the start of the string should be highlighted please do a simple `return string.replace( new RegExp( '^(' + escapedSubstring + ')', caseInsensitive ? 'i' : '' ), '<b>$1</b>')`.

Also if it's possible to make it that simple this should be a method in the file where this is used, not a whole class. In my humble opinion.