# Posts on-save processing with regex/replace configurable in admin panel

**URL:** https://meta.discourse.org/t/posts-on-save-processing-with-regex-replace-configurable-in-admin-panel/37202
**Category:** Feature
**Created:** [December 29, 2015, 12:30am UTC](https://meta.discourse.org/t/posts-on-save-processing-with-regex-replace-configurable-in-admin-panel/37202 "2015-12-29T00:30:05Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [December 29, 2015, 12:30am UTC](https://meta.discourse.org/t/posts-on-save-processing-with-regex-replace-configurable-in-admin-panel/37202/1 "2015-12-29T00:30:05Z")

</div>

If often fix minor issues in posts manually going through all of the posts on my forum on a daily basis. It turns out that most of the issues are typical and I could write a regex/rewrite rule to force the fix as soon as the message is posted or edited.

It would be nice to have such a section in admin panel with a set of rules, 2 inputs each:

1. Regex (optionally introduces regex references)
2. Replace with (optionally uses regex references)

## Examples

- Make empty lines between paragraphs
- Place space after comma if not inside a number (this rule is specific to Russian / Ukrainian locale)
- Remove links to websites from which smile embed codes were copied, i.e. `[url=...][img...][/url]`
- Place large images on their own lines and enforce an empty line before and after

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [December 29, 2015, 12:34am UTC](https://meta.discourse.org/t/posts-on-save-processing-with-regex-replace-configurable-in-admin-panel/37202/2 "2015-12-29T00:34:30Z")

</div>

Have you tried doing any of this with a plugin utilizing “Dialect”?

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [December 29, 2015, 3:33am UTC](https://meta.discourse.org/t/posts-on-save-processing-with-regex-replace-configurable-in-admin-panel/37202/3 "2015-12-29T03:33:00Z")

</div>

Nope, may you please clarify what you mean.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [December 29, 2015, 3:57am UTC](https://meta.discourse.org/t/posts-on-save-processing-with-regex-replace-configurable-in-admin-panel/37202/4 "2015-12-29T03:57:44Z")

</div>

> [@meglio](#):
>
> please clarify what you mean.

Something like the Pirate Speak plugin. eg.  
post text is passed into an anonymous function

```plaintext
Discourse.Dialect.postProcessText(function (text)

```

and a custom function “parses and manipulates” the text

> [@(Superseded) Plugin Tutorial #1 - How to manipulate the text in the composer?](https://meta.discourse.org/t/plugin-tutorial-1-how-to-manipulate-the-text-in-the-composer/10925):
>
> information_source This topic has been superseded by [Developing Discourse Plugins - Part 1 - Create a basic plugin](https://meta.discourse.org/t/developing-discourse-plugins-part-1-create-a-basic-plugin/30515) So, you want to manipulate the text in the composer but have no idea how? Let met guide you through the creation of a basic plugin that will turn the text into [Pirate Speak](http://en.wikipedia.org/wiki/International_Talk_Like_a_Pirate_Day). tada Update August 2018: you can create a complete discourse plugin skeleton in your plugins directory with [Rails plugin generator](https://meta.discourse.org/t/rails-plugin-generator/95907) tada First of all, you need to create a plugin.rb file that will b…

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [December 29, 2015, 5:56am UTC](https://meta.discourse.org/t/posts-on-save-processing-with-regex-replace-configurable-in-admin-panel/37202/5 "2015-12-29T05:56:43Z")

</div>

I see. No, my proposition is actually about a different thing. It may be a plugin, but configurable by admin, not hardcoded per-forum.

---

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [December 4, 2025, 11:37am UTC](https://meta.discourse.org/t/posts-on-save-processing-with-regex-replace-configurable-in-admin-panel/37202/6 "2025-12-04T11:37:12Z")

</div>


