Can I Use wild cards when comparing a URL?

0 favourites
  • 3 posts
From the Asset Store
Platformer tileset with wild west theme for creating western cowboy adventure games
  • I am using the browser object and URL to sitelock and was wondering if i am able to use wildcards such as *. when evaluating a value stored in a text variable so as to just accept the first part of an address? http://www. etc

    For example I want to be able to accept anything before the "." in the web address and always have the end part of the address the same "thisismysite.com" so some variations could be "www.thisismysite.com" "thisismysite.com" "m.thisismysite.com" "http://www.thisismysite.com"

    I am using a text variable to store the name of the site I want and then storing the URL in another and comparing them, although what i need to do is ignore the first part of the address so there are no issues, and I don't want to hard code the names.

    Is there a way to do this?

  • You can use the mid(text, index, count) system expression. Maybe something like:

    mySite = mid(fullURL, find(fullURL, "."), len(fullURL) - find(fullURL, "."))[/code:o51t7t2h]
    
    I didn't test it, so you may need to adjust the numbers in the index and the count. You can check whether the URL contains [url=http://]http://[/url], [url=http://www.]http://www.[/url], etc., using the [b]find(src, text)[/b] expression.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for pointing me in the right direction. I have used right(URLname,endPartOfURLcount) to grab the end part of the web address and store it, so 16 characters back from the end (which is the length of "thisismysite.com") then check this string against "thisismysite.com" as that part will never change. right(URLname,16) so it wont matter whatever else comes before it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)