mirror of
https://github.com/wader/fq.git
synced 2024-12-25 06:12:30 +03:00
18 lines
487 B
Plaintext
18 lines
487 B
Plaintext
# overload match to support buffer
|
|
def _orig_match($val): match($val);
|
|
def _orig_match($regex; $flags): match($regex; $flags);
|
|
def _match_try_buffer(bfn; fn):
|
|
( . as $c
|
|
| if _is_buffer then bfn
|
|
else
|
|
try fn
|
|
catch
|
|
( $c
|
|
| tobytesrange
|
|
| bfn
|
|
)
|
|
end
|
|
);
|
|
def match($val): _match_try_buffer(_match_buffer($val); _orig_match($val));
|
|
def match($regex; $flags): _match_try_buffer(_match_buffer($regex; $flags); _orig_match($regex; $flags));
|