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 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";

```
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>