Regular Expression Matching (Iterative)