Page 1 of 1

Javascript parsing html output

Posted: Mon Jun 23, 2008 5:08 am
by SpiderMonkey
I've got the following code:

Code: Select all

title=content.match("<title>.+</title>");
title=title.replace("<title>","");
title=title.replace("</title>","");
Which keeps telling me that title.replace is not a function. When (just to test) I change title.replace to content.replace it executes perfectly, although obviously producing the wrong output. Why is it doing this?

Re: Javascript parsing html output

Posted: Mon Jun 23, 2008 5:29 am
by arjan.top
title is array of matches

Re: Javascript parsing html output

Posted: Mon Jun 23, 2008 6:56 am
by SpiderMonkey
ah, ok thanks