Some use cases with code snippets. The magic happens by providing an onInput callback to specify what to highlight. The following examples show how.
You can specify an onInput callback that returns a regex. Text matched by the regex will be highlighted. This example simply highlights all numbers.
A common use case is to highlight from a list of 1 or more strings. This is easily done with regex. This example highlights certain country names.
The onInput callback can also return an array of arrays to specify highlights by character position. Each inner array has 2 values: a starting index (inclusive) and an ending index (exclusive). This example highlights the first 10 characters and the last 10 characters, as long as there are enough characters to do so.