Updated function to create regex from to different strings
Mage regex generation more accurate