Field operator does not accept a regex
```
$ gawk 'BEGIN{$0=3; print $/3/}'
3
$ nawk 'BEGIN{$0=3; print $/3/}'
nawk: syntax error at source line 1
context is
BEGIN{$0=3; print >>> $/ <<<
nawk: illegal statement at source line 1
nawk: illegal statement at source line 1
```
This should be legal according to POSIX. I can't find explicit support for it in the TAPL book (2nd ed.) but it seems to be at least implied.
关闭于 2025-06-08 4 条评论