Support » Plugin: Search Regex » Replace w regex not working

  • I’m having a similar problem as other users who are trying to use a regex to replace something. The “Search” button shows “matched row = 100, phrases = 283″ and the results correspond to everything I’m looking to replace.

    Search: <a\s(?:[^\s>]*?\s)*?href=”(.*?)”.*?>(.+?)
    Replace: $2

    Then I click on “Replace All” and it shows Replace progress going from 0 to 100 in under 2 seconds, with “0 phrases, 0 rows” affected.

    I’ve tried it on both Mozilla and Chrome. Same results. I’ve disabled all the other plugins on the site and set the theme to Twentyseventeen, but that didn’t change this behavior.

    Any suggestions?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author John Godley

    (@johnny5)

    The same response as the others – I’m unable to reproduce the problem, and will need more details. What source are you searching?

    Your browser will have no effect on this.

    Thread Starter docjohn

    (@docjohn)

    Posts and pages are the source, searching through approx. 8000 posts. I did not have this problem, ever, on the old version of the plugin (before the rewrite earlier this year). PHP is 7.2.

    Does your dev environment have a large set of posts like this?

    Sometimes other search and replace queries work. It just seems to not like complicated regex (even tho this regex isn’t that complicated).

    Happy to give you full access to the site to poke around and see for yourself?

    Plugin Author John Godley

    (@johnny5)

    Yes, it has been tested on a large set of data. The number of posts shouldn’t affect anything, other than time taken. The complexity of the expression also shouldn’t have any effect as PHP handles this, not the plugin.

    You say that sometimes other queries work. Can you give an example of an expression that does?

    Sure, if it’s possible to take a look and perform the query that would be great (I don’t want to accidentally change things though!) I can be contacted at https://searchregex.com/contact/

    The previous version is unrelated.

    Thread Starter docjohn

    (@docjohn)

    Done. You’re welcomed to run this query on the dataset that’s there. We have backups. Thanks for taking a look!

    Hi, I have the same problem. No replaces when click on “Replace All”.
    How do you fix it?

    Hello, I’m wondering if there has been any progress on this problem? I am experiencing the same issue where the plugin appears to work but the replacements don’t actually happen. I am happy to send screencaps which hopefully provide the details you need.

    Thank you very much, by the way, for this plugin. If I am able to get it to work, it will save me a lot of time.

    Plugin Author John Godley

    (@johnny5)

    No, there has been no progress. docjohn graciously gave me access and I saw the problem, but haven’t had time to dig into it further.

    I suspect at this point the only way to proceed is to have file-level access to a site with the problem, where I can make changes to the plugin and see why it is happening. Screenshots won’t show anything helpful.

    Been using Search Regex for years and love it, even donated to support development last year. Thank you for this awesome plugin!

    The older 1.x version was trickier to use but never failed on regular expressions. Today I was searching HTML using regular expressions on the latest release and it failed on me as described by others above.

    I had a perfect search and replace set up and everything looked fine, but when actually committing the change via “Replace All,” the plugin comes back with “0 phrases. 0 rows. Finished!”

    Not sure what to do now. I tried tweaking the regex by using slightly different patterns, but still no luck. Any thoughts?

    Well, I don’t know any other WP plugin with this kind of power to search & replace regular expressions, and I had to get this task completed – so what I did is temporarily downgrade.

    Version 1.4.16 is still available and fortunately the latest release of WordPress makes it easy to install plugins from downloaded zip files:

    https://wordpress.org/plugins/search-regex/advanced/
    [scroll to bottom for all official release downloads]

    Anyone else needing to do the same would just have to deactivate and uninstall Search Regex version 2.x first, then go to Plugins > Add New > Upload Plugin on your site’s WordPress menu and click Browse… then Install Now for the downloaded version 1.4.16 zip file.

    And keep in mind that delimiters are needed for searching with regular expressions in version 1.x.

    Plugin Author John Godley

    (@johnny5)

    That’s fine, although it does side-step the problem. I’ll note that the older version is likely to miss some matches, doesn’t search the same amount of data, and has a tendency to crash.

    roam92

    (@roam92)

    Hi @johnny5,

    Thanks for your fast response. True enough, although I used it for years with very few issues.

    Anyway, I hope to be able to upgrade back to version 2.x soon! I understand it’s a lot of work to support a widely-used plugin, which is why I’ve donated to support your work several times (under the plugin’s Options), and I hope other users do too. It’s just been an essential and super-helpful tool for my site.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.