Title: replace text between two tags
Last modified: August 21, 2016

---

# replace text between two tags

 *  [fabio.grasso](https://wordpress.org/support/users/fabiograsso/)
 * (@fabiograsso)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/replace-text-between-two-tags/)
 * Dear all
    I state that I am not a regex expert, but I’m trying to create a code
   based on some of the examples found on the web. My need is to replace the string
    -  with the string <li class=”ingredient”> in all my posts. This change, however,
      must be done only for text between the shortcode [ingredients title = XXXX]
      and [/ingredient].
    - I’ve found the regex for search only the text between the shortcode:
       /(\[
      ingredients.*?\[\/ingredients\])/ism
    - Anyone can help me for add to this the search of the
    -  code and then the replace with <li class=”ingredient”>?
    - thanks for your help
    - [http://wordpress.org/plugins/search-regex/](http://wordpress.org/plugins/search-regex/)

The topic ‘replace text between two tags’ is closed to new replies.

 * ![](https://ps.w.org/search-regex/assets/icon-256x256.jpg?rev=1030025)
 * [Search Regex](https://wordpress.org/plugins/search-regex/)
 * [Support Threads](https://wordpress.org/support/plugin/search-regex/)
 * [Active Topics](https://wordpress.org/support/plugin/search-regex/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/search-regex/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/search-regex/reviews/)

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [fabio.grasso](https://wordpress.org/support/users/fabiograsso/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/replace-text-between-two-tags/)
 * Status: not resolved