...

View Full Version : Search and Replace Help?



BatCountry
08-01-2008, 11:54 PM
Hi, I have a string:

article=editorial1&displayheight=" 512="" &shuffle="true

There's a small problem while processing, and I want to fix it with javascript by replacing:

displayheight=" 512=""
into:

displayheight=512

and

&shuffle="true
into:

&shuffle=true

--
I know I probaly have to use something like this:
string=string.replace(/displayheight="512=""/,'displayheight=512'
But it doesn't seem to work, anyone fix the regex?

oesxyl
08-02-2008, 01:36 AM
I know I probaly have to use something like this:
string=string.replace(/displayheight="512=""/,'displayheight=512'
But it doesn't seem to work, anyone fix the regex?

try to escape quote '"':


string=string.replace(/displayheight=\"512=\"\"/,'displayheight=512');


regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum