Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $re = '/((\s|^)(?<code>\d{4})(\t|\s|$))|(?<yandex>\d{14})|((?<money>\d{1,}(\,\d{2}|\.\d{2})?)р\.)/m';
- $str = '
- Пароль: 2918
- Перевод на счет 41001439721971
- Спишется 235,74р.';
- preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
- $result = [];
- foreach($matches as $match){
- $resource = ['code','yandex','money'];
- foreach($resource as $res){
- if(isset($match[$res]) && trim($match[$res]) != "") {
- $result[$res] = trim($match[$res]);
- }
- }
- }
- var_dump($result);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement