Regular expression matching in php
Posted
by
user1836428
on Stack Overflow
See other posts from Stack Overflow
or by user1836428
Published on 2012-11-19T16:47:26Z
Indexed on
2012/11/19
17:00 UTC
Read the original article
Hit count: 160
I have this regexp:
/(.*)(([0-9]([^a-zA-Z])*){7,}[0-9])(.*)/.
Given the following values
0654535263
065453-.-5263
065asd4535263
Expected Results
06****
06****
06****
Actual Results
0654535263
06****
065asd4535263
It does not match the last row because of the letters (I want to match from 0-3 letters) and it matches only last occurence (in the second row in example, it skips first row).
© Stack Overflow or respective owner