Would this help you at all?
Actually, I clicked the wrong button. This question is not answered (though I appreciate your responses).
This code returns true:
Though it should return false, because http://10.10.10.10.asdf is not a valid url.
Can anyone help?
It worked again for me using pattern.test()
pattern.test("http://10.10.10.10.asdf") returned false
pattern.test("http://10.10.10.10/asdf") returned true
This is the code I used. (I pasted your RegExp string and the urls to test into text input fields).
var s:String = urlField.text;
var reString:String = reField.text;
var re:RegExp = new RegExp(reString);
var pass:Boolean = re.test(s);
Alert.show(pass ? "passed" : "failed");
This seemed to solve the issue:
When you ip address doesn't match, it tries to match the
|condition. And it successfully does because
Try puting a
(?#IP Address). That way, when the ip address does match, it won't attempt the
|(?#Subdomains)(([-\w]+\.)+(?#TopLevel Domains))([a-z]+)after failing the