srujana Posted May 6, 2009 Share Posted May 6, 2009 Hi, I want to check whether few statements are present in the database or not. A regular where condition is sufficient for this. But my concern is that, the user may enter sentences like SMS short codes like 'txt' for text, 'dnt' for dont etc. is there any easy way with PHP or MySQL than manually checking with our common sense? Quote Link to comment https://forums.phpfreaks.com/topic/157051-search-with-php-with-extra-functionalities/ Share on other sites More sharing options...
RussellReal Posted May 6, 2009 Share Posted May 6, 2009 Regular Expressions is a uhm.. part of most every major main stream language, such as PHP, MySQL, JavaScript, ActionScript, its basically a package I suppose you can call it, whatever it may be called RegEx was created to match common or 'regular' expressions, in the form of patterns.. example: /^he(?:y|llo)$/i to match 'hey' or 'hello' php's regular expression functions are preg_match and preg_match_all for global searches.. MySQL uses somewhat of a 'command' to tell mysql that it is expecting a regular expression SELECT * FROM `table` WHERE `field` REGEXP 'he(?:y|llo)' Quote Link to comment https://forums.phpfreaks.com/topic/157051-search-with-php-with-extra-functionalities/#findComment-827302 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.