Could you post the error message?
I’m not familiar with the fastai code, but it looks like the regex is used to get (some part of) the path before the image number.
Could you also post a link to the lesson or code?