If you want to get just the matched text of a regular expression, I would use
grep -o 'regex' file
In the spirit of your code I would modify it to be
while read line; do
[[ $line =~ regex ]] || continue
# do somethinw with $line or $BASH_REMATCH, perhaps put it in an array.
done < file
If you want to match multiple regexes on the same line, here is a way.
while read line; do
# do somethinw with $line
done < <(grep -o 'regex' file)
I assume your regex is supposed to be a simplified example of what your really doing. The ? is not helpfull and your quotes are matching a literal string.