WordPress.org

Ready to get started?Download WordPress

Forums

Search Regex
can anyone help with regex replace syntax? (1 post)

  1. M One
    Member
    Posted 11 months ago #

    I need to clean the content of a wordpress site where the client has used the visual editor to style content across hundreds of pages resulting in a mess of nested span and style tags that need replacing with a simple class.

    For example - I need to replace:

    <h2 style="text-align: center;"><span style="color: #800080;"><strong>Page Heading</strong></span></h2>

    with the

    <h2 class="myclass">Page Heading</h2>

    I am using the regex search:

    @<h2 style="text-align: center;"><span style="color: #800080;"><strong>(.*?):</strong></span></h2>@

    This works but the replace @<h2 class="h2head">(.*?):</h2>@ does not - it just renders (.*?): instead of leaving the content between the tags intact as I want.

    Many thanks.

    http://wordpress.org/plugins/search-regex/

Reply

You must log in to post.

About this Plugin

About this Topic