PHP & Regular expression: keyword just occurs once
- by lauthiamkok
Hi,
how can I make sure a certain keyword just occurs once in the input with regular expression?
I think there is some mistakes in the expression below as I can repeat the same keywords,
if (!preg_match('/\b(.php?){1}\b/', $cfg_path))
{
$error = true;
echo '<error elementid="cfg_path" message="PATH - make sure you have a \'.php?\' in the path."/>';
}
I just want this to be true,
form.php?category=something or form.php?
but not this,
form.php?.php?category=something or form.php?.php?
please let me know how to fix it.
thanks.