Skip to content

Instantly share code, notes, and snippets.

@MrDys
Created March 1, 2011 20:15
Show Gist options
  • Save MrDys/849799 to your computer and use it in GitHub Desktop.
Save MrDys/849799 to your computer and use it in GitHub Desktop.
LC regexps
// Gives you the letter chunk at the beginning (PQ, in this case)
preg_match_all("/^[A-Z]{1,2}/", "PQ3979.2.M28 L33 1992", $letter);
// Gives you the numbers (I only really care about $number[0][0], so this is fine)
preg_match_all("/[0-9]{1,4}/", "PQ3979.2.M28 L33 1992", $number);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment