i have the next code:
textResponse = textResponse.replace(/<head>(.|\n)*?<\/head\>/img, '');
alert("Ups, Error " + jqxhr.status + ", " + textResponse);
it is used to display an error on an ajax req, the text response contains the html of the response page error, im striping that page of unnecessary content, so i try to remove the <head>
from the flowing string text:
<!DOCTYPE html>
<html>
<head>
<title>No hay usuario logeado</title>
<meta name="viewport" content="width=device-width" />
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
@media screen and (max-width: 639px) {
pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
}
@media screen and (max-width: 479px) {
pre { width: 280px; }
}
</style>
</head>
<body bgcolor="white">
<span><H1>Error de servidor en la aplicación '/HMSW'.<hr width=100% size=1 color=silver></H1>
...
but the string continues exactly the same, nothing is removed.
any idea why?