Im able to capture all values between parentheses with awk expression

```
'NR>1{print $1}' RS='(' FS=')'

```

But im struggling to match one in specific, where i do not want to match by line number but by a string. Not sure if that is possible with awk.

Original file content is

```
if ($remote_addr ~ ^(1.2.3.4|5.6.7.8)$) {
    set $maintenance off;
}

if ($maintenance = on) {
    return 503;
}

```

where there are multiple parentheses in different orders.

I need to extract content `1.2.3.4|5.6.7.8` from the line

```
if ($remote_addr ~ ^

```

(or simply in the line that contains `$remote_addr`).