I am trying to extract all IP addresses from an Apache log file input in the textarea field. I am using regular expressions for extracting the IP addresses. I want to see all the IP addresses printed on the screen. I cannot understand what I am doing wrong. Kindly help
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>RegEx_example</title>
</head>
<body style = "background-color: lightgrey">
<center>
<h3><u>Log Miner</u></h3>
<br /><hr />
<h5>Paste your Apache log file in the box below and click on Mine!</h5>
<textarea rows="25" cols="200" form="mine_log" id = "logs">
</textarea>
<form id = "mine_log" method = "" onsubmit="parseLogs(document.getElementById('logs').value)">
<input type = "submit" value = "Mine!!" />
</form>
<script language="JavaScript" type="text/javascript">
function parseLogs(text) {
var re = new RegExp("^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$");
var myArray = re.exec("text");
document.write(myArray.toString());
}
</script>
</center>
</body>
</html>