• Hi,

    I am trying to searh and replace for certain text within my database but have a small problem.

    The text I need to replace is over two lines and I have tried using the HTML chracter entites and a few other tricks but nothing seems to work.

    Unfortunately I don’t think I am able to perform two seperate queries.

    Here is the query text I am using:
    UPDATE wp_posts SET post_content=REPLACE(post_content, '<ul>
    <p></p>', '</ul>');

    As you can see there is a line break after the first <ul>

    Does anybody have any suggestions?

    TIA

Viewing 2 replies - 1 through 2 (of 2 total)
  • Some combination of newlines and carriage-returns should do it:
    REPLACE(post_content, '<ul>\n\r','</ul>');

    REPLACE(post_content, '<ul>\r\n','</ul>');

    REPLACE(post_content, '<ul>\n','</ul>');

    REPLACE(post_content, '<ul>\r','</ul>');

    Thread Starter planetphillip

    (@planetphillip)

    Thank you Sir,

    The singular n worked. Saved me doing that manually 1041 times!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Search And Replace Query’ is closed to new replies.