Synthesis Posted July 3, 2009 Share Posted July 3, 2009 (edited) Removed Edited February 7, 2021 by Synthesis Link to comment Share on other sites More sharing options...
Authenticity Posted July 3, 2009 Share Posted July 3, 2009 (edited) To make it a single input you need to decide whether the URL request will be something with a page part like:http://www.google.com/search?q=AutoItor anything is allowed, for example:www.google.com 1.2.3.4.5 this is not a url path at all etc..Take a loop for example on this:Dim $aURL[10] = ["http://www.google.com/search?q=hello", _ "yahoo.com/join?q=now&b=never", _ "gov.principle.com/outlaw?name=all", _ "http://www.www.w ww/loop/www?ww=w", _ "https://12.145.67.55/", _ "www.autoitscript.com", _ "https://www.w3c.com", _ "221.90.176.5/", _ "Not URL string", _ "Nither"] Dim $sPatt = "^((?:(?:https?|ftp|file)://)?[\w\d]+(?:\.[\w\d]+)+)/(.+)" UBound() For $i = 0 To 9 $aMatch = StringRegExp($aURL[$i], $sPatt, 1) If IsArray($aMatch) Then ConsoleWrite($i & '-> Host: ' & $aMatch[0] & ', Page: ' & $aMatch[1] & @CRLF) EndIf NextIf you'll change the last part of the regular expression pattern to (?.+))? you allow to strings without the page part to return as positive. Edited July 3, 2009 by Authenticity Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now