Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder BatCountry's Avatar
    Join Date
    Jul 2007
    Location
    McMaynerberry, Texas
    Posts
    57
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Thumbs up Search and Replace Help?

    Hi, I have a string:
    Code:
    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?

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by BatCountry View Post
    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 '"':
    Code:
    string=string.replace(/displayheight=\"512=\"\"/,'displayheight=512');
    regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •