Skip to content

Instantly share code, notes, and snippets.

@rodurma
Created October 27, 2016 19:57
Show Gist options
  • Save rodurma/cbfe16a8c2c447f3bcb7cea7111ad2b9 to your computer and use it in GitHub Desktop.
Save rodurma/cbfe16a8c2c447f3bcb7cea7111ad2b9 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>';
@SOSTheBlack
Copy link

niice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment