xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/rebrackloc.awk (revision 51396a8ee7fb52fe0ab33bfe7b4f495ad431904a)
1# The third argument to match() is a GNU-specific extension, so the
2# two following tests have been replaced with similar ones that use
3# RSTART and RLENGTH:
4#
5# match($0, /([Nn]ew) Value +[\([]? *([[:upper:]]+)/, f) {
6# 	print "re1", NR, f[1], f[2]
7# }
8#
9# match($0, /([][])/, f) {
10# 	print "re2", NR, f[1]
11# }
12
13match($0, /([Nn]ew)/) {
14	print "re1.1", NR, substr($0, RSTART, RLENGTH)
15}
16
17match($0, /[\([] *([[:upper:]]+)/) {
18	print "re1.2", NR, substr($0, RSTART+1, RLENGTH-1)
19}
20
21match($0, /([][])/) {
22	print "re2", NR, substr($0, RSTART, RLENGTH)
23}
24
25/[]]/ {
26	print "re3", NR, $0
27}
28
29/[\[]/ {
30	print "re4", NR, $0
31}
32
33/[[]/ {
34	print "re5", NR, $0
35}
36
37/[][]/ {
38	print "re6", NR, $0
39}
40
41/[\([][[:upper:]]*/ {
42	print "re7", NR, $0
43}
44
45/[\([]/ {
46	print "re8", NR, $0
47}
48