Use dark magic:
$array = preg_split('~\\\\.(*SKIP)(*FAIL)|\|~s', $string);
\\\\.
matches a backslash followed by a character, (*SKIP)(*FAIL)
skips it and \|
matches your delimiter.
More Related Contents:
- I need php regular expression to allow the all leters, numbers, dollar sign, commas, double & single quotes [closed]
- PHP / Regex: detect string after ?>
- Warning: preg_replace(): Unknown modifier
- Extract URLs from text in PHP
- Remove all special characters from a string [duplicate]
- PHP: Regex to ignore escaped quotes within quotes
- Get content between two strings PHP
- How to remove non-alphanumeric characters?
- What does the “[^][]” regex mean?
- Split camelCase word into words with php preg_match (Regular Expression)
- RegExp to strip HTML comments
- RegEx pattern to get the YouTube video ID from any YouTube URL
- Get Youtube Video ID from html code with PHP
- How to add hyphen to regex
- How do I remove blank lines from text in PHP?
- Regular expressions for a range of unicode points PHP
- How to write a recursive regex that matches nested parentheses?
- Split alphanumeric string between leading digits and trailing letters
- Allow only [a-z][A-Z][0-9] in string using PHP
- non-breaking utf-8 0xc2a0 space and preg_replace strange behaviour
- What literal characters should be escaped in a regex?
- Warning: preg_replace(): Unknown modifier ‘g’
- Validating US phone number with php/regex
- php regex [b] to
- RegEx BackReference to Match Different Values
- Regex to match text between commas
- PHP Regex Get Text Between BBCode Tags
- How to remove all numbers from string?
- Regular expression preg_quote symbols are not detected
- Detecting a url using preg_match? without http:// in the string