BASH_REMATCH

The bash array that holds the parts of a string matched by the last [[ =~ ]] regular expression test.

In more detail

Element 0 is the whole match and elements 1, 2 and so on are the capture groups. It is reset by every match, so copy values out before the next test.

Related terms

Taught in

References

Certification courses