sastro Posted July 22, 2009 Share Posted July 22, 2009 How to find if a string contain word some words. usualy i used Like this if(eregi('word1',$str) AND eregi('word2',$str) AND eregi('word2',$str) ...){ . . } But it will be eat the CPU resources when to many eregi. I need a simple solution for this. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/166888-please-help-with-eregi-and/ Share on other sites More sharing options...
nrg_alpha Posted July 22, 2009 Share Posted July 22, 2009 I would recommend ditching ereg and start learning preg (pcred) instead, as ereg (part of POSIX) is depreciated as of the current stable version (php 5.3) and will no longer be included within the core as of php 6. As for your string, could you show a sample and explain (without regex) what you are trying to match? Otherwise, I'm left making assumptions. Quote Link to comment https://forums.phpfreaks.com/topic/166888-please-help-with-eregi-and/#findComment-879956 Share on other sites More sharing options...
sastro Posted July 22, 2009 Author Share Posted July 22, 2009 There's no manual available for pcred() Is my problem can be resolve with preg_match? Quote Link to comment https://forums.phpfreaks.com/topic/166888-please-help-with-eregi-and/#findComment-879958 Share on other sites More sharing options...
mike12255 Posted July 22, 2009 Share Posted July 22, 2009 i might be mistaken, but i think he was talking about this page: PCRE Functions Quote Link to comment https://forums.phpfreaks.com/topic/166888-please-help-with-eregi-and/#findComment-879971 Share on other sites More sharing options...
nrg_alpha Posted July 22, 2009 Share Posted July 22, 2009 There's no manual available for pcred() Is my problem can be resolve with preg_match? Oops.. that will teach me not to post when tired. This is what I meant (in line with what Mike tried linking to (but got a 404 Not Found): pcre. Sorry about that. Additional, you can get started on preg by reading these: http://www.regular-expressions.info/ http://weblogtoolscollection.com/regex/regex.php http://www.phpfreaks.com/forums/index.php/topic,127902.0.html Quote Link to comment https://forums.phpfreaks.com/topic/166888-please-help-with-eregi-and/#findComment-879998 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.