#!/bin/bash
protocols='name : br-ext protocols : [protocol] name : br-ex protocols : [] name : br-local protocols : [other protocol] name : br-int protocols : []'
br='br-ext'
echo "$protocols" | grep -oP "$br\\s+protocols\\s*:\\s*\\[\\K[^][]*"
br='br-ex'
echo "$protocols" | grep -oP "$br\\s+protocols\\s*:\\s*\\[\\K[^][]*"