Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //That what i've understood in the begging :P
- $str = 'aaaaaaaaaa83744484855443543bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb162539847192837ccccccccccc54354ddddddddddd304948374658903eeeeeeeeeeeeee32532532g543ferfewfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
- $regExp = '#(.)\1{14}#';
- preg_match_all($regExp, $str, $match);
- var_dump($match);
- //That what you need:
- $str = '162539847192837ccccccccccc54354ddddddddddd304948374658903eeeeeeeeeeeeee32532532g543ferfewfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
- //with subpattrens will work with all PCRE libraries i think. use this if you get regexp compile error
- //$regExp = '#([^0-9]|^)([1-9][0-9]{14})[^0-9]([^0-9]|$)#';
- //With assertions, more Clean
- $regExp = '#(?<![0-9])([1-9][0-9]{14})(?=[^0-9])#';
- preg_match_all($regExp, $str, $match);
- var_dump($match);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment