Skip to content

Instantly share code, notes, and snippets.

@castrolol
Created January 26, 2018 16:03
Show Gist options
  • Save castrolol/77d0fa303359684b86a264dfe4a6a3c0 to your computer and use it in GitHub Desktop.
Save castrolol/77d0fa303359684b86a264dfe4a6a3c0 to your computer and use it in GitHub Desktop.
Regex RFID
<?php
$matches = [];
$rfid = "EPC: e2003532b5071f30b520687c RSSI: -58 PC: 3000 CRC: 808C TID: # 0";
preg_match("/^([0-9A-Z]+) *: +(?P<codigo>[a-zA-Z0-9]+)/", $rfid, $matches, PREG_OFFSET_CAPTURE);
echo "<pre>";
var_dump($matches["codigo"][0]);
echo "</pre>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment