<?php
$lines = [
'"#InstaFamous: How to Become Famous on Instagram" (2013) 2013-????',
'"#1 Single" (2006) {The Rules of Dating (#1.3)} 2006',
'"WWE Velocity" (2002) {(2005-11-05)} 2005',
'"#Follow" (2011) 2011-????',
'"!Next?" (1994) 1994-1995',
];
foreach ($lines as $key => $line)
{
preg_match('~
("?(?<showTitle>.*?)"?)
\s
\((?<showDate>\d{4})\)
([^{}\d]+)
(
({\(.*?\)})
|
({
(?<partTitle>.*?)?
(\( \#(?<season>\d+)\.(?<episode>\d+) \))?
})
)?
\s?
(?<partDate>([\d\-\?]+))
~misx', $line, $data);
foreach($data as $key => $value)
if(is_int($key))
unset($data[$key]);
var_dump($line, $data);
}
- Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- string(66) ""#InstaFamous: How to Become Famous on Instagram" (2013) 2013-????"
array(6) {
["showTitle"]=>
string(47) "#InstaFamous: How to Become Famous on Instagram"
["showDate"]=>
string(4) "2013"
["partTitle"]=>
string(0) ""
["season"]=>
string(0) ""
["episode"]=>
string(0) ""
["partDate"]=>
string(9) "2013-????"
}
string(52) ""#1 Single" (2006) {The Rules of Dating (#1.3)} 2006"
array(6) {
["showTitle"]=>
string(9) "#1 Single"
["showDate"]=>
string(4) "2006"
["partTitle"]=>
string(20) "The Rules of Dating "
["season"]=>
string(1) "1"
["episode"]=>
string(1) "3"
["partDate"]=>
string(4) "2006"
}
string(41) ""WWE Velocity" (2002) {(2005-11-05)} 2005"
array(6) {
["showTitle"]=>
string(12) "WWE Velocity"
["showDate"]=>
string(4) "2002"
["partTitle"]=>
string(0) ""
["season"]=>
string(0) ""
["episode"]=>
string(0) ""
["partDate"]=>
string(4) "2005"
}
string(26) ""#Follow" (2011) 2011-????"
array(6) {
["showTitle"]=>
string(7) "#Follow"
["showDate"]=>
string(4) "2011"
["partTitle"]=>
string(0) ""
["season"]=>
string(0) ""
["episode"]=>
string(0) ""
["partDate"]=>
string(9) "2011-????"
}
string(25) ""!Next?" (1994) 1994-1995"
array(6) {
["showTitle"]=>
string(6) "!Next?"
["showDate"]=>
string(4) "1994"
["partTitle"]=>
string(0) ""
["season"]=>
string(0) ""
["episode"]=>
string(0) ""
["partDate"]=>
string(9) "1994-1995"
}
- Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected '[' in /in/eR05E on line 3
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected '[' in /in/eR05E on line 3
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/eR05E on line 3
Process exited with code 255.
preferences:
238.68 ms | 401 KiB | 348 Q