I'm pretty sure what you're looking for are called regular expressions. A quick google search should turn up what you're looking for.
Exactly! Thanks :)
I don't understand your initial question though.
Ok I'll try elaborate. I have a text with something like this:
I want the file to read .jp but it also read .jpg
So how do I make it only read .jp and only that not ad the g or any other letter after...?