I want to get a certain string from an .torrent name but I’m only getting this from it:
array
0 => string 'e' (length=1)
What have I done wrong? This is the preg_match I use:
preg_match('/[S(0-9)E(0-9)]/i', 'True.Blood.S04E12.SWESUB.PDTV.XviD-DSMEDiA', $matches);
Thanks in advance.
Remove the square brackets and put them around the numbers and add
+(meaning 1 or more) after them. This way you get the entire S##E## string, plus the numbers separately:You could also replace
[0-9]with\d