Regular Expression For indenfity google search pages [closed] - php

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
I would like to get the regular expression to identify whether a url is a google search home page or search results page .

You can use something like this :
(https?:\/\/www\.google\.(?:(?:com)|(?:co\.in)).*#q=.+)
For Google search result url.
Since in Google the searched word will be there , after q=
DEMO
Explanation:

Related

Is it possible to read sub URL as query string in PHP? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
This is my LOCAL URL:
http://localhost/wbdrupal/?url=http://werkbad-konfigurator.de/datahub/searchObjectByID?table=furniture&column=wbid&search=
when I echo this variable $_GET['url'];
then the output is http://werkbad-konfigurator.de/datahub/searchObjectByID?table=furniture
but I need output as http://werkbad-konfigurator.de/datahub/searchObjectByID?table=furniture&column=wbid&search=
I need full query string when I write this command: echo $_GET['url'];
Your URL is malformed and can't be parsed. The system has no way of knowing which key/value pairs belong to the actual URL or to the url value you're trying to submit.
You need to URL-encode your values so the system can know what the key/value pairs are:
http://localhost/wbdrupal/?url=http%3A%2F%2Fwerkbad-konfigurator.de%2Fdatahub%2FsearchObjectByID%3Ftable%3Dfurniture%26column%3Dwbid%26search%3D

php preg_replace working only if there's ending space in string [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I have this pattern:
preg_replace_callback('##abc\((.*?)\)(.*?)#end.#is', ..
My template string:
$test = "#abc('test')<h1>test</h1>#end"; // not working
$test2 = "#abc('test')<h1>test</h1>#end "; // working
Why it doesn't work if there's no space after #end?
As #Rizier123 pointed out, this is the correct regex:
preg_replace_callback('##abc\((.*?)\)(.*?)#end#is', ..

What is the "returnto" in this piece of code [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
header("Location: {$TBDEV['baseurl']}/login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]));
Is it a variable? PHP reserved word? something to do with HTML?
It's a $_GET parameter. When you submit the code, the page receiving it will be able to use $_GET['returnto'] to return you to the page you're currently on.
Take some time to learn about $_GET

Php help find where is syntax error [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes===".$card['id']."") as $kat){
echo (kat['id_categories']);
}
table cols and values are all matched, something is wrong in this part of code
I tried adding $ before kat and using only one "=", sill doesnt work
NEW LINK
http://pastebin.com/RPK7vEaJ
this
where id_kartes===".$card['id']."
would be
where id_kartes=".$card['id']."
and missing $
echo $kat['id_categories'];
so full code :-
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes='".$card['id']."'") as $kat){
echo $kat['id_categories'];
}
best practice if you store your query result in a variable and loop over this variable.
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes=".$card['id']."") as $kat)

PHP Regex preg_match won't work [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
if (preg_match("/<response>(.*)<\/response>/iUms", '<response>CONNECTED_OK</response>', $mathces))
{
var_dump($matches);
}
I tried this, but at first i had a downloaded page with cURL with the subject I now have hard coded in. I have tried lots of other things but it always return $matches with null.
Try this:
if (preg_match("/<response>(.*)<\/response>/iUms", '<response>CONNECTED_OK</response>', $matches)) { var_dump($matches); }
You had $mathces instead of $matches

Categories