remove extra url validation
move pattern definition outside of loop