Sorry, maybe this will help you out.
i want to take a hash of simple regex ie(0-9, a-z) and match them in square brackets/box brackets:
The matched value in the brackets then gets checked from a sub(to make it simple i have it go though the sub) and if the sub returns something it uses the value the sub returned and if the sub did not return anything it keep the data as it was