There's plenty of possibilities, but you could use the
function ereg, for example.
ereg('#',$string1);
should do the job for you, it returns a boolean true for string1 and false for string2
I'd recommend reading the php manual sections on regular expressions and String-functions
edit
Someone mentioned this article before, might also come in handy if you're trying to do more complex string operations.
http://www.phpbuilder.com/columns/dario19990616.php3
/edit