Open cdepillabout opened 7 years ago
Implementing this would require figuring out what options to pass to compileRegexWith
.
It would be nice to make highlight
work the same as grep
. grep
seems to assume ascii regexes when not running in a UTF8 locale. However I haven't thoroughly tested this.
If someone wanted to write-up how grep
handles ASCII/UTF8 regexes based on the locale, that would be a big help. It should be beginner-friendly.
It would be nice to support UTF8 regexes.
Here is an example of doing an UTF8 regex with grep:
Here is what happens when using highlight:
Note that highlight is just working on a character-by-character basis, so it is possible to do a regex on japanese if you account for most japanese characters being 3 bytes in utf8:
When running the three previous examples, my locale settings are as follows:
Changing it to
LC_ALL=en_US.ASCII
makesgrep
ignore utf8 and output the same thing ashighlight
.