It is right. AWK regular expressions do not have flags.
In addition, there is no built-in support for matchfinding a second or later match.
Only functions gsuband gensubhave it. I would try something like this:
gensub(/.*<a href=\"([^\"]+)/, "\1%", "g")
last = split($0, "%", arr)
delete arr[last]
where %is a string that you can guarantee will not be found in the input.
source
share