helpwanted Posted December 26, 2006 Share Posted December 26, 2006 Hi All,I need regular Expression to match to the string "DirectoryName".Only this need to be validated .If it is specified as "Directory_Name" or "Directoryname",it must return error.Please help me giving regular expression for this in an PHP application Link to comment https://forums.phpfreaks.com/topic/31858-regular-expression-help/ Share on other sites More sharing options...
btherl Posted December 26, 2006 Share Posted December 26, 2006 The regular expression "DirectoryName" will do that. For example:[code=php:0]if (ereg('DirectoryName', $string) == 1) { print "Match\n";}[/code]But it would be faster to use strpos:[code=php:0]if (strpos($string, 'DirectoryName') !== false) { print "Match\n";}[/code] Link to comment https://forums.phpfreaks.com/topic/31858-regular-expression-help/#findComment-147827 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.