This is an example line in the document I am processing:
2011-08-08|M|Misc Info|6PM|Away vs. First Words, Second String, Third|Other Info
I would like to get everything between "Away vs." and the next "|"
Just use php's explode function to make an array.
$str = "2011-08-08|M|Misc Info|6PM|Away vs. First Words, Second String, Third|Other Info";
$arr = explode($str, '|');
$parts = $arr[4];
$newArr = explode($parts, ',');
$string = '2011-08-08|M|Misc Info|6PM|Away vs. First Words, Second String, Third|Other Info';
$parts = explode('|', $string);
echo $parts[4]; // This is what you are looking for.
I don't see why you would use regexes here.
If you are using PHP 5.3 there's another solution:
$parts = str_getcsv($string, '|');
echo $parts[4]; // This should be the part you're looking for
str_getcsv also understands enclosed strings, making it more robust.
strpos() until it reached the correct pipe, but a test showed that it was considerably slower than this solution. +1.
|a|b|c|has three three fields if pipe-delimited and five fields if pipe separated.