Optimize quality regex