Skip to content

Instantly share code, notes, and snippets.

@cagartner
Forked from rodurma/filters.php
Created October 27, 2016 19:59
Show Gist options
  • Save cagartner/9c08d1f69dce2d8ae944935d57d04ee1 to your computer and use it in GitHub Desktop.
Save cagartner/9c08d1f69dce2d8ae944935d57d04ee1 to your computer and use it in GitHub Desktop.
Filtros estilo GMail
<?php
$input = 'nome:ps4 sku:SKU7889-988;OI99129 data:10/12/2016 nome:Playstation 4 nome:Nintendo Wii sku:TESTE123 9aos';
preg_match_all('/(?:([^: ]+):)([^: ]+(?:\s+[^: ]+\b(?!:))*)/', $input, $matches, PREG_SET_ORDER);
echo $input;
echo '<pre>';
print_r($matches);
echo '</pre>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment