How can I replace all regex matches using the WP_CLI search-replace tool

Under the hood, WP-CLI uses preg_replace() to perform the regex search-replace operation. By default, preg_replace() is a global operation. If WP-CLI is only replacing the first instance, there may be some other issue at hand.

If you’ve found a bug though, and can provide a test case to reproduce it, please open an issue and we can get it fixed.

Leave a Comment