Extract characters out of string in php -


lets string motive s01e13 hdtv x264 evolve eztv need find out episode in string. season 1 episode 13. need extract 13 out of string. i'm newer php . so, lets say:

$title = 'motive s01e13 hdtv x264 evolve eztv'; 

i need find 'e' , see if next 2 characters numerical values. assume... ahead of time!

i think you're looking for:

$title = 'motive s01e13 hdtv x264 evolve eztv'; preg_match('/s\d\de(\d\d)/i', $title, $matches); echo $matches[1]; // 13 

this output 13, you're looking for. work on formatted string, , output episode number (as long format s00e00 followed). case insensitive, if care that.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -