d.shankar Posted November 4, 2009 Share Posted November 4, 2009 Hi i am new to regular expression. I need to match a string "apple" with preg_match eventhough if get a string called "kaskjslkjsdfapple" it should match with the regex because this string has apple within it. can anybody help ? Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 4, 2009 Share Posted November 4, 2009 #apple# Quote Link to comment Share on other sites More sharing options...
d.shankar Posted November 4, 2009 Author Share Posted November 4, 2009 Hi thanks. do i have to use like this ? <?php $pattern='#apple#'; if(preg_match($pattern,"asdadapple")) { echo "found"; } else { echo "notfound"; } ?> Thanks Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 4, 2009 Share Posted November 4, 2009 Hi thanks. do i have to use like this ? Why don't you try and see? Quote Link to comment Share on other sites More sharing options...
d.shankar Posted November 4, 2009 Author Share Posted November 4, 2009 i dont have a php intrepreter with me now thats why i posted here. i'll go home and check it. thanks ! Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 4, 2009 Share Posted November 4, 2009 I see. It works fine. Quote Link to comment Share on other sites More sharing options...
d.shankar Posted November 4, 2009 Author Share Posted November 4, 2009 Thanks a lot Mchl.! Quote Link to comment Share on other sites More sharing options...
d.shankar Posted November 4, 2009 Author Share Posted November 4, 2009 Indeed it works. Thanks . Topic Solved. RIP Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.