What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 150 Stack Exchange communities.

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:


share|improve this question
Will this erase some or all of the following? Here is my code: [newline] <begin code block>MyString = thanks – Brian Webster Mar 3 '13 at 7:14
Also see: meta.stackexchange.com/a/93989/212673 – Brian Webster Mar 3 '13 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 Mar 3 '13 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 – Brian Webster Mar 3 '13 at 16:19
@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 Mar 3 '13 at 16:20
Apparently we get many "Thanks"s in code instead of plaintext: stackoverflow.com/questions/12588746/… (I found a bunch with search: code:thanks) – Doorknob Mar 3 '13 at 16:21
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. – Annonomus Penguin Mar 9 '13 at 17:52
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 Mar 9 '13 at 18:28
+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. – Wesley Murch Mar 9 '13 at 19:02
This would be great, thanks – Ben Brocka Mar 9 '13 at 21:28

You must log in to answer this question.

Browse other questions tagged .