Was this helpful?
The REGPOS built-in variable is set whenever a regular expression match is made (i.e., whenever the ~ or !~ operators are used, or an implicit match is made from the pattern section of the pattern action block). It is set to the position where the match was made in the input string. REGPOS should not be changed by the user.
"abcdef" ~ /cd/
results in REGPOS being set to 3 (the 1-based offset into the Source string).
Last modified date: 08/10/2022