Matching keywords with preg_match

I am trying to match keywords only in a string like this,

if (preg_match("(gif|jpg)", "jpge")) {
    echo "A match was found.";
} else {
    echo "A match was not found.";

and it returns - ‘A match was found’ which is not I want…

how should I write the expression so that it only match keywords like ‘gif’ and ‘jpg’, in other words, i dont want it to return true if the string has ‘jpge’, such as above.

many thanks,

This might help you out:

cool thanks will have a look.
cheers mate. :smiley: