modify grep implementation.

use scanner. speed up.