Can I Use wild cards when comparing a URL?

Get help using Construct 2

Post » Thu Jan 29, 2015 10:02 pm

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?
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619

Post » Thu Jan 29, 2015 10:18 pm

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

Code: Select all
mySite = mid(fullURL, find(fullURL, "."), len(fullURL) - find(fullURL, "."))


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 http://, http://www., etc., using the find(src, text) expression.
Don't see the fnords and they won't eat you!
B
79
S
17
G
12
Posts: 323
Reputation: 11,850

Post » Fri Jan 30, 2015 9:33 am

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.
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests

cron