I think you want preg_split.
list($year, $month, $day, $hour, $min, $sec) = preg_split('/[: -]/', $post_timestamp);
More Related Contents:
- Replace string only once with php preg_replace
- Reference – What does this regex mean?
- How do I match any character across multiple lines in a regular expression?
- Is there a PHP function that can escape regex patterns before they are applied?
- Regular expression pipe confusion
- How to use conditionals when replacing in Notepad++ via regex
- Exclude characters from a character class
- How to make dot match newline characters using regular expressions
- Can you make just part of a regex case-insensitive?
- Multi-line regular expressions in Visual Studio Code
- Verbs that act after backtracking and failure
- How is the AND/OR operator represented as in Regular Expressions?
- Remove ‘index.php’ from URL with .htaccess
- Regex Until But Not Including
- Math operations in regex
- Multiple words in any order using regex [duplicate]
- How to split a long string without breaking words?
- How to capitalize first letter of first word in a sentence?
- How do I extract query parameters from a URL string in PHP?
- How to replace a whole line with sed?
- Replace newlines with literal \n
- Split string into sentences using regex
- Regex to match an ISO 8601 datetime string
- Replace tabs and spaces with a single space as well as carriage returns and newlines with a single newline
- How to capture multiple regex matches, from a single line, into the $matches magic variable in Powershell?
- Regular Expression usage with ls
- PHP and regexp to accept only Greek characters in form
- How to validate that a string only contain lowercase letters?
- Difference between regex quantifiers plus and star
- Finding and removing Non-ASCII characters from an Oracle Varchar2