#!/bin/bash
s='$2y$15$nK/B6u765645/lo0867h56546v/BnH5U5g45Aj67u67nMVtrhryt6'
grep -Ea '\$2[ayb]\$.{56}' <<< "$s"