updated to use beregex