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 ? Link to comment https://forums.phpfreaks.com/topic/180306-solved-newbie-to-regex/ Share on other sites More sharing options...
Mchl Posted November 4, 2009 Share Posted November 4, 2009 #apple# Link to comment https://forums.phpfreaks.com/topic/180306-solved-newbie-to-regex/#findComment-951140 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 Link to comment https://forums.phpfreaks.com/topic/180306-solved-newbie-to-regex/#findComment-951148 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? Link to comment https://forums.phpfreaks.com/topic/180306-solved-newbie-to-regex/#findComment-951155 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 ! Link to comment https://forums.phpfreaks.com/topic/180306-solved-newbie-to-regex/#findComment-951177 Share on other sites More sharing options...
Mchl Posted November 4, 2009 Share Posted November 4, 2009 I see. It works fine. Link to comment https://forums.phpfreaks.com/topic/180306-solved-newbie-to-regex/#findComment-951187 Share on other sites More sharing options...
d.shankar Posted November 4, 2009 Author Share Posted November 4, 2009 Thanks a lot Mchl.! Link to comment https://forums.phpfreaks.com/topic/180306-solved-newbie-to-regex/#findComment-951191 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 Link to comment https://forums.phpfreaks.com/topic/180306-solved-newbie-to-regex/#findComment-951204 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.