I'm try to extract the "INV" part of the string below:

```
123_456_P1234_INV_UID-123456.PDF

```

Here's the code I have so far:

```
php -r 'echo preg_match("/_(.*?)_UID-.*?\.PDF$/", "123_456_P1234_INV_UID-123456.PDF", $cat) ? $cat[1]."\n" : "";'

```

This returns:

```
_456_P1234_INV

```

Can anyone tell me why it's including everything before the INV bit? How can I fetch just the INV part please?