Advance RE match index for zero-width matches and g flag.
Use EXIT trap to print pass/fail.
Remove slightly non-standard use of { in sed script.