Question: I'm stuck writing a preg\_match

I have a string:

```
XPMG_ar121023.txt

```

and need to extract the 2 letters between `XPMG_` and the first digit - be it a 0-9

```
$str = 'XPMG_ar121023.txt';
preg_match('/('XPMG_')|[0-9\,]))/', $str, $match);
print_r($match);

```

Maybe this isn't the best option: My characters will always be

Answer: 
This is too simple for a regular expression. Just `$match = substr($str,5,3)` would get what you're asking for.
Well, why not:

```
$letters = $str[5].$str[6];

```

:)
After all, you'll always need the 2 chars after the fixed prefix, there are many ways that do not require a regexp (`substr()` being the best anyway)