added regex function to support selecting valid patents
regex now works on select statement