Skip to content

Instantly share code, notes, and snippets.

@mapkyca
Created June 1, 2014 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mapkyca/a06b5b31c7345edba875 to your computer and use it in GitHub Desktop.
Save mapkyca/a06b5b31c7345edba875 to your computer and use it in GitHub Desktop.
Regex to find ISO8601 date and time in text using PHP
<?php
preg_match('/([0-9]{4}-?[0-9]{2}-?[0-9]{2}T[0-9]{2}:?[0-9]{2}:?[0-9]{2}[+-Z]?([0-9]{2,4}:?([0-9]{2})?)?)/',$text, $matches);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment