I have a string that contains an html document. I need to know if this string contains the substring <title>Anmelden - Text</title>. Unfortunately there are some new lines in the string, so that the string looks like this:
...
<title>
Anmelden - Text
</title></head>
...
I have tried the following code:
var idx = html.search( /<title>\n*.*Anmelden.*\n*<\/title>/ );
But idx is always -1. If I remove the <title>and </title>the expression works.
I have used http://regexpal.com/ to verify my regex. There it works on my input.
What am I doing wrong?
getElementsByTagName()to get the title.<title>[\S\s]*?Anmelden[\S\s]*?<\/title>.*, use\s|\Sor[^]or some such hack to match ANY character including newline.