The regex may just need a slight tweak. Instead of 56[7$]
instead you should use one of the following
56($|7)
56($|[7YE])
Within [], the $ is attempting to match a literal dollar sign. You are instead looking for $ to match an end of line and so it can't be within square brackets.