Jump to content

preg_matching a website address?


Monkuar

Recommended Posts

I need to use preg_match, to check if "mywebsite.com" exists inside a string.

 

how would do I go about that? :P

 

Im not looking to validate urls, im just looking to see if the string has mywebsite.com in it, if true, i can use w/e, or return false.

 

Thanks

 

hmm would strpos or strmatch work ?

 

Something like this

 

if (preg_match("/http://mysite.com/i", "GOBBLYBLUETEXTHEREBLABLAH")) {
    echo "A match was found.";
} else {
    echo "A match was not found.";
}

 

 

actually would that work?, lmk ima be testing

 

Link to comment
https://forums.phpfreaks.com/topic/259138-preg_matching-a-website-address/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.