Sorry I’m kinda new to regex, anyways I have a url like http://example.com/test/folder/?get=ThisisaValue and I need it to return whether the word “get” is in there or not.
Whenever I run the function I get no match? Any help is appreciated thank you.
Sample code, let’s say $_SERVER['HTTP_REFERER'] is http://example.com/hello/?state=12345
if(preg_match("state", $_SERVER['HTTP_REFERER'])) {
echo "match";
} else {
echo "no match";
}
In that case you don’t need to match anything – you can just check for whether the substring is in the string, using
strpos().