cdlink14
02-18-2009, 02:13 PM
Ok firstly using this as an example... ( Posted by Paul186 here = >> Clicky << (http://www.indigorose.com/forums/showpost.php?p=134224&postcount=3)
1. HTTP.Download("http://www.ipchicken.com/", _TempFolder .. "\\tempfile", 2. MODE_TEXT);
3. error = Application.GetLastError();
4. if (error == 0) then
5. page = TextFile.ReadToString(_TempFolder .. "\\tempfile");
6. File.Delete(_TempFolder .. "\\tempfile", false, false, true);
7. ip = string.sub(page, string.find(page, '%d+%.%d+%.%d+%.%d+'));
8. if (ip ~= nil) then
9. Dialog.Message("IP Address","Your public IP address is '" .. ip .. "'.");
10. else
11. Dialog.Message("IP Address","Not found");
12. end
13. else
14. Dialog.Message("Error", _tblErrorMessages[error], MB_OK,
15. MB_ICONEXCLAMATION);
16. end
From what I can gather on line 7. The '%d+%' is used to find a set of numbers.
What would I do to find a set of letters?
If possible could someone show me by making an example using this test url
http://server123.test.com/download/654321/made up file.rar.001
I hope this is possible.
Thanks for any help,
CDLINK14
1. HTTP.Download("http://www.ipchicken.com/", _TempFolder .. "\\tempfile", 2. MODE_TEXT);
3. error = Application.GetLastError();
4. if (error == 0) then
5. page = TextFile.ReadToString(_TempFolder .. "\\tempfile");
6. File.Delete(_TempFolder .. "\\tempfile", false, false, true);
7. ip = string.sub(page, string.find(page, '%d+%.%d+%.%d+%.%d+'));
8. if (ip ~= nil) then
9. Dialog.Message("IP Address","Your public IP address is '" .. ip .. "'.");
10. else
11. Dialog.Message("IP Address","Not found");
12. end
13. else
14. Dialog.Message("Error", _tblErrorMessages[error], MB_OK,
15. MB_ICONEXCLAMATION);
16. end
From what I can gather on line 7. The '%d+%' is used to find a set of numbers.
What would I do to find a set of letters?
If possible could someone show me by making an example using this test url
http://server123.test.com/download/654321/made up file.rar.001
I hope this is possible.
Thanks for any help,
CDLINK14