Question: ```
Babylon 5 Season 4 Episode 13 Rumors Bargains and Lies 45

```

how i can extract numbers that comes after Season and the numbers that comes only after episode not any number after that. in the above example. i would want only 4 and 13 numbers using php using preg\_match thanks in advance

Answer: 
You can do something like this:

```
$str = 'Babylon 5 Season 4 Episode 13 Rumors Bargains and Lies 45';

if (preg_match_all("/(Season|Episode) (\d.)/", $str, $matches)) {
    var_dump($matches);
}

```

And it will output:

```
   array (size=3)
      0 => 
        array (size=2)
          0 => string 'Season 4 ' (length=9)
          1 => string 'Episode 13' (length=10)
      1 => 
        array (size=2)
          0 => string 'Season' (length=6)
          1 => string 'Episode' (length=7)
      2 => 
        array (size=2)
          0 => string '4 ' (length=2)
          1 => string '13' (length=2)

```
You can have your `Season` and `Episode` values in an array `m`:

```
preg_match_all('/.*Season\s+(?<season>\d+)\s+Episode\s+(?<episode>\d+)/', $str, $m);

print 'Season: ' . $m['season'][0] . "\n";
print 'Episode: ' . $m['episode'][0] . "\n";

```