Regex matching wrong strings
Posted
by Joe Smalley
on Stack Overflow
See other posts from Stack Overflow
or by Joe Smalley
Published on 2010-04-14T14:46:44Z
Indexed on
2010/04/14
15:03 UTC
Read the original article
Hit count: 320
I have this PHP/SQL query:
$sql = sprintf("SELECT * FROM %sCubeCart_filemanager WHERE filepath REGEXP '%s[\\/\\\\][^\\/\\\\]+$' AND type = '%d' AND disabled = '0' ORDER BY filepath ASC %s", $this->_config['dbprefix'], str_replace(array('\\','/'),'.',$folder), $type, $limit);
if '$folder' == 'iha9' it is finding results like 'iha91' and 'iha99' too. Something is wrong with the regular expression, but I don't know how they work, can anyone help?!
© Stack Overflow or respective owner