#!/bin/bash
test="$(echo -e "123456\ntest\r\n123456789\n\n\nup to here")"
reg="123456(.*)up"
if [[ $test =~ $reg ]]; then
echo ${BASH_REMATCH[1]};
fi
IyEvYmluL2Jhc2gKdGVzdD0iJChlY2hvIC1lICIxMjM0NTZcbnRlc3RcclxuMTIzNDU2Nzg5XG5cblxudXAgdG8gaGVyZSIpIgpyZWc9IjEyMzQ1NiguKil1cCIKaWYgW1sgJHRlc3QgPX4gJHJlZyBdXTsgdGhlbgogIAllY2hvICR7QkFTSF9SRU1BVENIWzFdfTsKZmk=