Added optional order by to SQL regex