Prime Regular expression and Thread