-6

As presented, Regex Named Groups in Java is not a valid fit for this site, as it is seeking for software recommendations, which is disallowed on Stack Overflow:

It is my understanding that the java.regex package does not have support for named groups (http://www.regular-expressions.info/named.html) so can anyone point me towards a third-party library that does?

The reason recommendation are disallowed is explained in the help center:

Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

That all being said, the (edited portion of the) top answer is perfectly valid for the Q&A format, had the question not been a library request, but rather a "How can I use named capturing groups in Java". Specifically, that named capturing groups have been in Java since Java 7 (which was released after the question was asked).

This is an old question (first asked 13 years ago) and an old answer (also 13 years old) with the Java 7 edit being around for most of that time (about 11 years). It currently has a question score of 199 and answer score of 317.

What is the proper thing to do here?

My intuition is that ideally, we'd retitle this question to something like "What Java third-party libraries support regex named groups?", close it as "not suitable for this site", then open a new question in Q&A format asking how to use named capturing groups in Java. This is a common enough issue that I feel this Q&A pair adds concrete value to this site.

Since this question is as popular and involving core functionality as it is, I figured I'd verify my assumption with the community first before throwing in my title edit, vote to close, and self-answered question.

I guess another approach in the same vein would be to create the question and give the answerer (still active high-rep user @VonC) first dibs at copying his answer over since he's clearly earned the reputation for the solid answer.

I don't think it makes sense to restructure the question to match the answer, since there are other answers tailored to the off-topic actual library request.

11
  • 1
    it is clearly about programming , so what is your problem exactly
    – nbk
    Jan 10, 2022 at 21:18
  • @nbk Quoth myself: "it is seeking for software recommendations, which is disallowed on Stack Overflow". Quoth the link in that sentence: "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it."
    – M. Justin
    Jan 10, 2022 at 21:19
  • 1
    I'll admit that at the time of asking, it was absolutely a library request, and that as written still reads as a library request. Given that java now has that functionality, i think we can survive with just leaving it alone and nuking any future library answers as they come (or issuing a historical lock if that becomes too cumbersome.)
    – Kevin B
    Jan 10, 2022 at 21:22
  • @nbk I've updated my question to quote the relevant help center section
    – M. Justin
    Jan 10, 2022 at 21:22
  • searching for a library is not per se offtopic,, as you could have testet one and it doesn't work. so programming related
    – nbk
    Jan 10, 2022 at 21:24
  • 7
    @nbk we literally have a close reason just for that specific purpose. being "about programming" isn't enough.
    – Kevin B
    Jan 10, 2022 at 21:25
  • @nbk It is absolutely off topic, as it is explicitly defined to be so: "Questions asking us to recommend or find a […] software library […] are off-topic for Stack Overflow" While being programming-related is a necessary condition for a question being on-topic on Stack Overflow, it is not a sufficient one.
    – M. Justin
    Jan 10, 2022 at 21:27
  • 2
    While questions seeking recommendations are disallowed. Library recommendation answers are allowed as long as they demonstrate how to use the tool. The question could very easily be converted into a "How-to". Many of the answers may also be salvageable with a small bit of sample code. (Though I don't know how many of the answers are still valid)
    – Henry Ecker Mod
    Jan 10, 2022 at 21:30
  • The question as it stands is requesting a resource and you would not be incorrect to close it as such. Otherwise it could be edited to be acceptable. Either would likely be fine, so you do you /shrug Jan 10, 2022 at 21:52
  • Quite a lot of energy invested in a question which can pretty much be considered legacy. If you still need that question and it's answers, I feel sorry for you because your runtime environment must be ancient and nearly impossible to maintain. And in that feeling sorry for them, I would not want to take the information away from them in any way. Just let it be. I would vote for a historic lock.
    – Gimby
    Jan 11, 2022 at 10:29
  • @Gimby I only occasionally use Java regexes directly, and even less frequently use named capturing groups. That means that when I do, I generally have to look up the syntax. The Stack Overflow answer that most directly spells out how to use named capturing groups is this question. In fact, I just needed it in a Java 17 app. So the "how do I do this" in Java part of the question is very much not legacy. The rest of the question — "is there a third party library" is definitely legacy. This is a key reason I cared enough to even ponder the question I posed.
    – M. Justin
    Jan 11, 2022 at 10:51

1 Answer 1

3

What is the proper thing to do here?

Nothing, at least to the question. The question is fine.

You may have been tripped up by the literal semantics of "no software recommendations", which is still absolutely true, but if you peer closer...

  • The original sentiment was that this support didn't exist in Java 6, and it exists in Java 7+
  • The majority of the world is on Java 7+
  • Users who need to use this feature simply can without a third-party library
  • The question is satisfactorily answered

The answers that exist on it recommending libraries could do with some tidying up, but I'd leave that more for the mods than us to do.

You must log in to answer this question.

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