search-replace-command icon indicating copy to clipboard operation
search-replace-command copied to clipboard

Search-replace command do not work properly

Open betagoo opened this issue 7 years ago • 2 comments

I think, the search-replace command do not work properly.

Post content code contains: some text <a href="[page_url 363]" class="btn">anchor text</a> some text

This wp-cli command found only 14 posts: search-replace '<a\s+href="\[page_url\s+363\]"([^>]+)>([^<]+)<\/a>' 'ReplaceText' wp_posts --regex --allow-root --regex-flags='i' --regex-delimiter='/' --log --dry-run

Should find 73 posts.

If I make get_posts and execute preg_replace function on post content, the php script found every occurences into 73 posts (there is one occurence in one post).

Pattern, delimiters and flags are the same.

betagoo avatar Jan 18 '19 07:01 betagoo

Hey @betagoo !

I'd like to run some tests to try to replicate this issue. Could you please confirm if the text that changes is only the number?

marksabbath avatar Aug 05 '20 19:08 marksabbath

Also, sharing the code you've run that found 73 entries and the database would be very helpful :)

marksabbath avatar Aug 05 '20 19:08 marksabbath