mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-25 08:53:55 +00:00
Port regex captures from C to Go
This commit is contained in:
parent
026e752cb7
commit
d429d91163
1 changed files with 37 additions and 0 deletions
37
go/todo.txt
37
go/todo.txt
|
|
@ -26,9 +26,46 @@ w discussion re docs6 ...
|
|||
|
||||
* csv -> csv/tsv throughout
|
||||
|
||||
----------------------------------------------------------------
|
||||
REGEX CAPTURES
|
||||
|
||||
* sub/gsub have function scope
|
||||
|
||||
o MlrvalSub/MlrvalGsub
|
||||
- example: '$b = sub($a, "(..)_(...)", "\2-\1")'
|
||||
- old: lib.RegexReplaceOnce/re.ReplaceAllString
|
||||
- new:
|
||||
> match input(1) against regex(2)
|
||||
> replace each match with \d-enabled string
|
||||
> lumin-like loop with as-is/as-will-be alternations
|
||||
|
||||
$ echo a='12_345 67_890' | mlrc --oxtab put '$b = sub($a, "(..)_(...)", "\2-\1")'
|
||||
a 12_345 67_890
|
||||
b 345-12 67_890
|
||||
|
||||
$ echo a='12_345 67_890' | mlrc --oxtab put '$b = gsub($a, "(..)_(...)", "\2-\1")'
|
||||
a 12_345 67_890
|
||||
b 345-12 890-67
|
||||
|
||||
* =~/!=~ have callback scope
|
||||
|
||||
o MlrvalStringMatchesRegexp/MlrvalStringDoesNotMatchRegexp
|
||||
- old: re.MatchString
|
||||
- new:
|
||||
> matcher needs to write the regex-captures object
|
||||
> string-evaluator needs to check for captures -- ?
|
||||
* BuildStringLiteralNode -- check if matches '.*\d.*' pattern
|
||||
|
||||
$ echo a=12_3456 | mlrc --oxtab put '$a =~ "(..)_(....)"; $b = "left_\1"; $c = "right_\2"'
|
||||
a 12_3456
|
||||
b left_12
|
||||
c right_3456
|
||||
|
||||
----------------------------------------------------------------
|
||||
DOC6
|
||||
|
||||
* all sorts of line-wraps in command-blocks
|
||||
|
||||
* colored-shapes.dkvp -> csv; also mkdat2
|
||||
* data/small -> csv throughout. and/or just use example.csv
|
||||
* quicklinks -- ?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue