|
Posted by Sjoerd on 03/16/07 18:15
fienen@gmail.com wrote:
> if (preg_match("isbn:?%20", $value))
> ...
> Doesn't seem to work though. Any thoughts?
- The pattern of preg_match needs delimiters. Mostly slashes are used
for this: /pattern/
- Each statement should be ended with a semicolon;
- Note that PHP automatically URL-decodes the GET parameters, so %20 in
the URL will become a space in the GET variable.
- You can use the matches parameter to retrieve the ISBN number.
- When asking a question here, "doesn't seem to work" is not good
enough. Insert echo statements to see whether the preg_match actually
matches and report any error you get in your post.
if (preg_match("/isbn:? ([0-9X]*)/", $value, $match))
{
$isbn = $match[1];
}
else
{
$isbn = $value;
}
Sjoerd
Navigation:
[Reply to this message]
|