There is a regex that should automatically remove all greetings from the top of posts. It does its job very well:

^                 # begins at start of body
\s*               # possible spaces
hii?(?![a-z])|    # any of these greeting words
.*?               # followed by anything, up to...
[.,;!-]+          # one or more bits of punctuation
\s*               # possible spaces
(\r?\n)+          # one or more newlines

I propose we add one for "thanks" and related endings. Here is my draft:

(in adva?nced?\s*)?
([\:\;]\s*[\-\~\=]*\s*[\)\]\}\>D3]+)* #smilies :) :D ;-3 etc.

I am sure there could be many improvements, but it's a start. And it will save many an editor's time.

And because I couldn't resist the irony:


  • 1
  • Will this erase some or all of the following? Here is my code: [newline] <begin code block>MyString = thanks Commented Mar 3, 2013 at 7:14
  • Also see: meta.stackexchange.com/a/93989/212673 Commented Mar 3, 2013 at 7:15
  • @GeorgeWBush That's a very rare if not impossible case in which the code would have to end at the very end and the code would be setting a variable to "thanks" for some reason. Also in most programming languages you would need single or double quote around it. @ your second comment Err... that's what I put in my question
    – Doorknob
    Commented Mar 3, 2013 at 13:15
  • In my example, "thanks" would also be a variable name. It's not impossible, but is is extremely rare. I posed it because I was trying to poke holes in your regex. Is it worth breaking 1 honest codeblock in order to auto-remove 1 million superfluous signatures? Code blocks and block quotes should probably be immune Commented Mar 3, 2013 at 16:19
  • 1
    @GeorgeWBush Yes. Yes, of course it is. Who names their variables "thanks," anyway? I'll search code for "thanks" and see what pops up :P
    – Doorknob
    Commented Mar 3, 2013 at 16:20
  • 3
    Apparently we get many "Thanks"s in code instead of plaintext: stackoverflow.com/questions/12588746/… (I found a bunch with search: code:thanks)
    – Doorknob
    Commented Mar 3, 2013 at 16:21
  • 5
    I agree but disagree. Some may think it's impolite not to say that. What I hate is when someone gains reputation for removing "Thanks." Do you get promotions at jobs for removing "Thanks" in a coworker's email when replying? People that do it to me the most usually cannot gain from edits anymore, but it is very possible to gain rep just for removing a greeting (which doesn't really add to the answer/make it easier to understand). Like someone else said on another post, a three letter "Hi," isn't going to reduce the quality of the post and prevent people from vising: it's polite. Commented Mar 9, 2013 at 17:52
  • 3
    Is there nothing better to work on or improve on StackExchange, than to remove people for thanking each other??! What has this world come to :-O hahah
    – d-_-b
    Commented Mar 9, 2013 at 18:28
  • 1
    +1 simply for d? in adva?nce?d. That drives me nuts. However, I predict this could have a high rate of failure or false positives, perhaps too much to be worth it.
    – user159834
    Commented Mar 9, 2013 at 19:02

1 Answer 1


I think that having this implemented would make a great start on improving the professional appearance of questions on every Stack Exchange site.

The Tour of every site already says that there should be no chit chat, and I think unnecessary thanks are an example of chit chat.

A Meta Stack Overflow Q&A that resonates with me is No Thanks, Damn It!

  • 5
    The "remove greetings" filter has had issues. I'm sure a thanks-removing filter will find new and exciting ways to mangle posts.
    – Mark
    Commented Jun 20, 2018 at 23:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .