Title: [Plugin: Search Regex] Inserting newlines
Last modified: August 20, 2016

---

# [Plugin: Search Regex] Inserting newlines

 *  [Jani Uusitalo](https://wordpress.org/support/users/jani-uusitalo/)
 * (@jani-uusitalo)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-search-regex-inserting-newlines/)
 * There was a topic about [replacing br tags with newlines on Urban Giraffe](http://urbangiraffe.com/support/topic/replace-ltbr-gt-with-newline),
   but it seems to have led nowhere, so I’m posting this here just so that I can
   find it when I again need it, and maybe of help to others too.
 * I modified the search_and_replace function on line 37 of models/search.php so
   that $this->replace is assigned a replaced string itself:
 *     ```
       $this->replace = str_replace("\\n", '
       ', $replace);
       ```
   
 * This means I want to replace any occurences of “\n”‘s in my replacement string
   with actual newlines just prior to applying the replacement.
 * It’s an ad hoc solution which I’m reverting once I’m done with newlines. I’ve
   not explored any possible side effects this solution may have, so use with caution.
 * **Edit:** Forum ate my br.
 * [http://wordpress.org/extend/plugins/search-regex/](http://wordpress.org/extend/plugins/search-regex/)

The topic ‘[Plugin: Search Regex] Inserting newlines’ 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/)

 * 0 replies
 * 1 participant
 * Last reply from: [Jani Uusitalo](https://wordpress.org/support/users/jani-uusitalo/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-search-regex-inserting-newlines/)
 * Status: not a support question