I'm working on a PHP based application extension that will extend a launcher style app via the TVRage API class to return results to a user wherever they may be. This is done via Alfred App (alfredapp.com).
I would like to add the ability to include show name followed by S##E##: example: Mike & Molly S01E02
The show name can change, so I can't stop it there, but I want to separate the S##E## from the show name. This will allow me to use that information to continue the search via the API. Even better, if there was a way to grab the numbers, and only the numbers between the S and the E (in the example 01) and the numbers after E (in the example 02) that would be perfect.
I was thinking the best function is strpos
but after looking closer that searches for a string within a string. I believe I would need to use a regex to correctly do this. That would leave me with preg_match
. Which led me to:
$regex = ?;
preg_match( ,$input);
Problem is I just don't understand Regular Expressions well enough to write it. What regular expression could be used to separate the show name from the S##E## or get just the two separate numbers?
Also, if you have a good place to teach regular expressions, that would be fantastic.
Thanks!