mirror of
https://github.com/wader/fq.git
synced 2024-09-20 08:18:51 +03:00
Add comment how raw byte regexp matching works
This commit is contained in:
parent
7f36f703dd
commit
36fd74a181
@ -882,6 +882,9 @@ func (i *Interp) find(c interface{}, a []interface{}) gojq.Iter {
|
||||
io.RuneReader
|
||||
io.Seeker
|
||||
}
|
||||
// raw bytes regexp matching is a bit tricky, what we do is to read each byte as a codepoint (ByteRuneReader)
|
||||
// and then we can use UTF-8 encoded codepoint to match a raw byte. So for example \u00ff (encoded as 0xc3 0xbf)
|
||||
// will match the byte \0xff
|
||||
if strings.Contains(flags, "b") {
|
||||
// byte mode, read each byte as a rune
|
||||
rr = ioextra.ByteRuneReader{RS: bb}
|
||||
|
Loading…
Reference in New Issue
Block a user