This tutorial will show you have to do a clipping mask in Photoshop.
Difficulty: Beginner
First Open a new document with any size.
Then select the text tool and write something.
Then just take some random image and add to the document, I took this one:
Remember to put the text and image in different layers. The text layer should be below the image layer.
Then go to Layer > Create Clipping Mask (Alt+Ctrl+G).
The text will now look like this:
Now play around and move the image, and it will only be inside the text.
The use of text was just an example, you can do it with shapes etc.