So I am doing some form validation and I am trying to take user input that only calls the function once both conditions have been met. So far it seems that only the first condition being met will result in a "Works" alert while the second condition does not need to be satisfied. I could input the ~ to try and satisfy the second condition but it will still give me the "Broken" alert. I'm not sure if I can just combine both link1 and link2 into one condition where my function will check for the input to start with http:// but also check for a ~ in the url somewhere.
var link1 = /[~]/;
var link2 = /^http:\/\//;
var input = document.getElementsByName("textbox")[0];
if(input.value.match(link1 && link2)) {
alert("Works");
} else {
alert("Broken");
}