Problem 5: Matching specific filenames

If you use Linux or the command line frequently, are often dealing with lists of files. Most files have a filename component as well as an extension, but in Linux, it is also common to have hidden files that have no filename.

In this simple example, extract the filenames and extension types of only image files (not including temporary files for images currently being edited). Image files are defined as .jpg,.png, and .gif.

Exercise 5: Capturing filename data
Task Text Capture Groups  
skip .bash_profile To be completed
skip workspace.doc To be completed
capture img0912.jpg img0912 jpg To be completed
capture updated_img0912.png updated_img0912 png To be completed
skip documentation.html To be completed
capture favicon.gif favicon gif To be completed
skip img0912.jpg.tmp To be completed
skip access.lock To be completed

We are only looking for image files ending with the 'jpg', 'png' and 'gif' file extensions, so we can capture all such filenames using the expression (\w+)\.(jpg|png|gif)$.

Solve the above task to continue on to the next problem, or read the Solution.