Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Patrick van Kemenade 97 posts 325 karma points
    Feb 04, 2020 @ 10:32
    Patrick van Kemenade

    Umbraco Search/Replace in content (text)

    What is the best/easiest/safest way to search for a specific string in textual content and replace it with something else.

    In my case this would be

    <a href="/specific-url/" to <a href="/prefix/specific-url/"

    And do you do this directly in the database using a query (on all published content) or via code or plugin ?

  • Ismail Mayat 4511 posts 10062 karma points MVP 2x admin c-trib
    Feb 04, 2020 @ 14:04
    Ismail Mayat

    For v7 there was but according to this post you are on v8 right? You could fork the source and update to v8?

  • Patrick van Kemenade 97 posts 325 karma points
    Feb 04, 2020 @ 18:15
    Patrick van Kemenade

    Ok, thanks, grabbed a copy of the zip. Updated it to 8.5.3. The searching part worked immidiatly. But since the plugin is created for a website in 1 language the SetValue function crashed, Found solution (inject culture using $routeParams.mculture). I've communjcated the code changes to github.

    Only 1 annoying bug left and that is in the replacement parameter trailing spaces are stripped off. It doesn't seem to be in the code so I guess this is an angular bug. If anybody recognizes this or knows how to solve this would like to know.

Please Sign in or register to post replies

Write your reply to: