fork(1) download
  1. <?php
  2.  
  3. $string = 'LOREM : 10505050
  4. IPSUM : 1050051051084
  5. DOLOR : 2620620620652
  6. AMETI : 54084840540540
  7. LOREM : 10505050
  8. IPSUM : 1050051051084
  9. DOLOR : 2620620620652
  10. AMETI : 54084840540540
  11. LOREM : 10505050
  12. IPSUM : 1050051051084
  13. DOLOR : 2620620620652
  14. AMETI : 54084840540540';
  15.  
  16. $regex = '(([\w]+) : ([\d]+))';
  17. preg_match_all($regex, $string, $matches);
  18.  
  19. var_dump($matches);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  array(12) {
    [0]=>
    string(16) "LOREM : 10505050"
    [1]=>
    string(21) "IPSUM : 1050051051084"
    [2]=>
    string(21) "DOLOR : 2620620620652"
    [3]=>
    string(22) "AMETI : 54084840540540"
    [4]=>
    string(16) "LOREM : 10505050"
    [5]=>
    string(21) "IPSUM : 1050051051084"
    [6]=>
    string(21) "DOLOR : 2620620620652"
    [7]=>
    string(22) "AMETI : 54084840540540"
    [8]=>
    string(16) "LOREM : 10505050"
    [9]=>
    string(21) "IPSUM : 1050051051084"
    [10]=>
    string(21) "DOLOR : 2620620620652"
    [11]=>
    string(22) "AMETI : 54084840540540"
  }
  [1]=>
  array(12) {
    [0]=>
    string(5) "LOREM"
    [1]=>
    string(5) "IPSUM"
    [2]=>
    string(5) "DOLOR"
    [3]=>
    string(5) "AMETI"
    [4]=>
    string(5) "LOREM"
    [5]=>
    string(5) "IPSUM"
    [6]=>
    string(5) "DOLOR"
    [7]=>
    string(5) "AMETI"
    [8]=>
    string(5) "LOREM"
    [9]=>
    string(5) "IPSUM"
    [10]=>
    string(5) "DOLOR"
    [11]=>
    string(5) "AMETI"
  }
  [2]=>
  array(12) {
    [0]=>
    string(8) "10505050"
    [1]=>
    string(13) "1050051051084"
    [2]=>
    string(13) "2620620620652"
    [3]=>
    string(14) "54084840540540"
    [4]=>
    string(8) "10505050"
    [5]=>
    string(13) "1050051051084"
    [6]=>
    string(13) "2620620620652"
    [7]=>
    string(14) "54084840540540"
    [8]=>
    string(8) "10505050"
    [9]=>
    string(13) "1050051051084"
    [10]=>
    string(13) "2620620620652"
    [11]=>
    string(14) "54084840540540"
  }
}