Title: WP CLI Search-Replace Wildcard Usage
Last modified: February 17, 2018

---

# WP CLI Search-Replace Wildcard Usage

 *  [calimer](https://wordpress.org/support/users/calimer/)
 * (@calimer)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-search-replace-wildcard-usage/)
 * Hi!! I’m trying to remove some code from my databases using WP CLI but I’m having
   trouble with the search-replace wildcards. I’ve so far been unable to find an
   example of the syntax.
 * This is what I have so far:
    wp search-replace ‘<noindex><script id=”wpinfo-pst1″*
   </script></noindex>’ ” wp_posts wp_postmeta wp_terms –dry-run
 * I want to clear all the text that includes, and is between:
    <noindex><script
   id=”wpinfo-pst1″ and </script></noindex>
 * Thank you so much for your time!
    -Mike

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Simon Prosser](https://wordpress.org/support/users/pross/)
 * (@pross)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-search-replace-wildcard-usage/#post-9985198)
 * **Make a backup 1st of course.**
    `wp search-replace '<noindex(.*?)>(.*?)<\/noindex
   >' '' --regex wp_posts wp_postmeta wp_terms --regex-flags='ms' --dry-run` **Make
   a backup 1st of course.**
 *  Thread Starter [calimer](https://wordpress.org/support/users/calimer/)
 * (@calimer)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-search-replace-wildcard-usage/#post-9985294)
 * Thank you so much!! I was going crazy trying to find some good examples from 
   the WP CLI documentation but I didn’t realize that it is using (I’m strongly 
   assuming) php syntax.
 * I can’t thank you enough, this helps a ton!
    -Mike

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP CLI Search-Replace Wildcard Usage’ is closed to new replies.

## Tags

 * [wp-cli](https://wordpress.org/support/topic-tag/wp-cli/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [calimer](https://wordpress.org/support/users/calimer/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-search-replace-wildcard-usage/#post-9985294)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
