Re: preg_match_all problem

From: Date: Thu, 10 Oct 2002 10:28:26 +0000
Subject: Re: preg_match_all problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-119511@lists.php.net to get a copy of this message
> Hi, I'm a frog (french), > > I,ve some troubles with the preg_match_all function. > > <input type="TEXT" name="search" maxlength="50" > size="36" > > $strSearchWords = Trim($search); > $pattern = $strSearchWords; > > and while (!feof($openFile)) > { > $strFileContents .= fgets($openFile, 4096); > } > > $strPageTitle = htmlentities(GetFileMetaTag("<title>", > "</title>", $strFileContents)); > $strPageDescription = htmlentities(GetFileMetaTag("<meta > name=\"description\" content=\"", "\">", > $strFileContents)); > $strPageKeywords = htmlentities(GetFileMetaTag("<meta > name=\"keywords\" content=\"", "\">", $strFileContents)); > $strFileContents = $strPageTitle." ".$strPageDescription." > ".$strPageKeywords; > $strFileContents = str_replace("; "," ",$strFileContents); > $strFileContents = str_replace(","," ",$strFileContents); > > then I get the following warning message: > > Delimiter must not be alphanumeric or backslash in : > if (preg_match_all($pattern,$strFileContents,$match) > 0) > > WHAT CAN I DO ??? > I had this problem only a day ago. You have forgotten to add slashes to your pattern. The variable $pattern looks something like this: "\d+\s" when it should look like this: "/\d+\s/" Hope that was helpful, Archie --- Archibald Zimonyi arsi@cd.chalmers.se "There is no logic like no logic"

« previous php.general (#119511) next »