There are many problems with what I perceive to be countless dupes of low quality questions in the [regex] tag. Rather than complaining about it, I've decided to take matters into my own hands.

I'm thinking that I should start a series of [regex] articles.

I do fear retaliation from the community, accusation of rep-whoring, etc, so I decided that perhaps I should start with more advanced techniques that is rarely (if ever) covered before. If I get good feedback (by votes and comments), then I may eventually start to cover some of the basics, stuff that has already been covered no doubt dozens if not hundreds of times before (at that point it may become somewhat of a rep-whoring, since it's essentially dupes of many dupes, but I hope in putting together well-written articles with generic but carefully-chosen examples, we can link them from the tag info for good learning resources).

I'd like feedback from the community before I start to embark on this effort.

Why advanced first?

The advanced articles will most probably be original, i.e. not dupes, but at the same time may not be as useful to the general public as the basic articles. The problem with the basic articles, of course, is that they've already been covered at various corners of the [regex] tag, but rarely (as far as I know) in a way that is comprehensive, self-containing, and aimed at being educational (instead of just writing an answer for the sake of getting votes/acceptances).

My reasoning for starting with advanced first is, like mentioned, to avoid accusation of rep-whoring. Once I've earned the community's trust, I'd then gradually move on to the basics.

The Go Ahead

OK, guys, I've decided to do this. I'm a bit busy right now so I'm not sure when I'll start, but probably within a week or so. Thanks for the feedback.

List of articles

I've started it.

This is not part of the articles, but someone asked a very good inquisitive question, and my solution uses nested reference, so it's very much in line with the current series:

I'll appreciate all feedbacks and comments.

Unresolved questions

  • Should we create a tag for this series and/or others? What should it be? Is it a meta tag?
  • 2
    My vision for the distant future: instead of linking to regular-expressions.info, we have these materials in-house at stackoverflow instead. That said, I need to reiterate that the more advanced articles I plan to write isn't covered by that website. At least not to the greater details that I plan to cover, with examples, etc. Aug 29, 2010 at 13:45
  • 3
    You could make them CW. That would probably be quite fitting, since they aren't answerable. Also it wouldn't be a rep farming scheme, and if you aren't doing it for the rep anyways…
    – googletorp
    Aug 29, 2010 at 14:23
  • 1
    @googletorp: I do want the rep. Ideally I want these articles to be so useful to everyone that I'd keep getting rep even when I'm away from stackoverflow. I also do sincerely want to help others learn and to contribute as much as I practically can to stackoverflow before I'm gone. I think contributing this way is better than hitting F5 repeatedly waiting for a dumb question to pop-up so you can give a dumb answer for quick and easy reps. If others think it's not fair for me to do this, then they're free to do it also. The more material like these we have on SO, the better. Aug 29, 2010 at 14:42
  • 3
    I'd be in favor of this if the first article is on techniques for using regexes to parse HTML. Aug 29, 2010 at 14:48
  • 2
    On a more serious note, article-type content has been posted successfully by other users (for example, GMan's What is the copy-and-swap idiom?). I think if the articles are well written, they will be well-received. Aug 29, 2010 at 14:50
  • @James: At quick glance, that looks like an awesome link! Unfortunately I don't do [c++], so I may not be able to fully appreciate GMan's effort at a technical level, but I'll give it a try right now. Aug 29, 2010 at 14:54
  • @James: WOW! That is an awesome read! It looks like the bar has been set pretty high for these kinds of articles... which is a good thing! Thank you for further inspiring me to do my best. Aug 29, 2010 at 15:12
  • @polygenelubricants - Based of a quick glance of your tags I would have to say that I would definitely keep an eye on any articles you write. Aug 30, 2010 at 19:48
  • +1 - Good idea. I'd love to learn more about regular expressions. Also, I'd love to help you in distributing/posting these articles if you like.
    – jjnguy
    Aug 30, 2010 at 21:17
  • 2
    MAKE THE INSANITY STOP!!!!!! stackoverflow.com/questions/tagged/html+regex Aug 30, 2010 at 21:54

7 Answers 7


I think this is a great idea and Stack Overflow needs more in-depth question/answer articles like this. The benefits are many:

  • Stack Overflow gets better content
  • Well written articles will rank highly in search engines for relevant terms
  • The tag faq page will really reflect frequently asked questions
  • It provides something definitive to connect to the other end of "duplicate of" close votes
  • Users who provide valuable content are rewarded with rep points (that's what they're for)
  • 2
    possibly, unless they degenerate into hairy "community FAQ" type monstrosities. Sep 5, 2010 at 11:07
  • 5
    @Jeff: can you elaborate on your concern? I don't quite understand it. Sep 6, 2010 at 16:40

As someone who would potentially benefit from such articles, I'd say go for it. As long as they fit the proper 1 question, 1 correct answer format I don't see why anyone would have a problem with it.


If you post your articles, are you going to do it in the FAQ type format on here where you ask a dummy question and give your obligatory in depth responses (which I do appreciate, I'm tired of one liner answers), or are you going to put it all in the question?

In general, how would the answers be handled? It would almost seem like your doing a reverse SO format where you ask a question containing all the information, then people would answer with questions, and then comments would explain it. I'm just not sure how certain parts of the SO community would take to this. I would almost expect a close before you can even post your answer.

While I love the idea, its the execution that I'm worried about.

  • The advanced articles would have a lot of prerequisite information in the question alone, and then even more information and explanation in the answer which I'll immediately provide. The more basic articles would probably just have "what is this?" and "how do I do that?" type of questions, with detailed answers providing alternatives, caveats, etc. Aug 29, 2010 at 14:51

My 2 cents :

Go for it, it's always a valuable source.

But from other websites and mailing lists I have the experience that the people who read it, don't ask questions easily found in a basic manual, and those that don't bother reading the manual, are probably not going to read your efforts either. So I do expect a valuable source of information, but alas no decline in "that kind of questions"...


The articles so far are very interesting. It's good you chose to start with advanced topics, it is defiantly more interesting than a standard article.

One thing that bothers me a little is the short time between the question and the answer - 21 seconds in case of the anbn article. I'm bored with most regex questions, which as you've said are mostly repetitive and of low level. I don't know how many people on SO would have found the ingenious answer in this case, but I'd like to see people try. For one, the .Net and recursive pattern solutions were almost immediate to me, but I didn't see a point in posting them after your answer - and the question wasn't inviting of extra answers, as you've acknowledged and dismissed these options as too easy :).

  • The article was originally written with PCRE constraint, but that was before I knew that it supported recursive pattern. So really the constraint I had in mind is Java regex; I've since made that correction. Certainly other flavors offer different solutions (and I referenced both recursive and balancing group option for those flavors way in the beginning at the question itself, with references) but I think those can be their own articles, rather than having a gigantic one that discusses all flavors together. Feel free to start your own articles for those flavors. Sep 6, 2010 at 20:32

Definitely go for it.

I would suggest starting with the basics, and moving to more complex questions, since it is easier to read along that way. In other words, the basic questions will enable to comprehension of the more advanced questions.

I wouldn't worry about accusation of rep whoring and whatnot. If you write quality regex questions, and then you provide (even immediately) quality answers, I am sure everyone will appreciate it.

I would definitely up vote both your quality questions and answers. Getting rep for contributing to the community is what rep is all about, so you would deserve the rep.

Working code snippets (jsFiddle, Codepad, RegExr, etc, would be superb),

  • 1
    Thank you for the links! I usually use only Rubular, but I think I should also look into alternatives to compare with. I've added your suggestion to meta.stackexchange.com/questions/55442/… - feel free to suggest some more directly at that question. Aug 30, 2010 at 7:30

There is nothing wrong with asking and answering your own questions; it's even encouraged. Go for it.

If they are exact duplicates though, don't, consider updating the duplicate instead. But if the questions are in-depth as you say it's highly unlikely they will be exact duplicates.

  • 1
    The problem is that sometimes the duplicates are numerous. With regex, how many dupes are there about anchoring your match? e.g. Q: "Why doesn't /pattern/ work?" A: because you need to do /^pattern$/ instead!" - instant 15 votes right there. And this happened probably a dozen of times. Aug 30, 2010 at 7:27

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