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 use regex look behind to capture numbers.

```
(?<=Season)\s*?\d+|(?<=Episode)\s*?\d+

```

It should capture 4 and 13.

See <https://regex101.com/r/JVOUOw/2>