Rectangle 27 10

Specific Implementation of the Stack Overflow Blog

Because the SO blog currently fills the role of the network-wide blog, there would be unique challenges in bringing community blogging to Stack Overflow. Below are some ideas for how to approach this site and the transition from SO's blog being for everyone to being run by the community:

Network-wide posts should appear on the front page along with all other posts under the "all posts" tab. They would all be marked with their own special tag, stack-exchange. This would denote that the post applies to the whole network, and is not a community blog post but an official, SE, Inc. approved post. This tag would be a moderator-only tag (like community-ads or status-completed on Meta) so that only approved people could post network-wide announcements. Certain other tags (such as podcast) should also be moderator-only.

In the tabs for the SO blog, there would be a "stack exchange" tab for network-wide stack exchange posts, a podcast tab for the SE podcast, and then a few other tags for SO site-specific stuff, like tutorials, QOTW, or whatever else the site may want to promote.

A blog post explaining the change in what "blog.stackoverflow" is (since it would now be allowing community posts) would be posted to the current blog before a switch.

Once switched, both network-wide posts and SO-specific posts would appear on the site. The current RSS address for the SO blog (http://blog.stackoverflow.com/index.php/feed/) would continue to only point to posts tagged stack-exchange and podcast, so that people currently subscribed would not suddenly start getting posts about question on Stack Overflow. Tag-specific RSS feeds could be used (exactly like how you subscribe to a tag on any SE site) for new subscribers.

For consistency, blog. stackexchange.com would contain only posts tagged stack-exchange, and function essentially as it does now.

Here is a mockup specifically for the Stack Overflow blog. Click for full-size.

discussion feature-request blog blog-overflow
Rectangle 27 6

Jeff Atwood himself described how StackOverflow.com sanitizes user input (in non-language-specific terms) on the Stack Overflow blog: http://blog.stackoverflow.com/2008/06/safe-html-and-xss/

However, as Justin points out, if you use Django templates or something similar then they probably sanitize your HTML output anyway.

SQL injection also shouldn't be a concern. All of Python's database libraries (MySQLdb, cx_Oracle, etc) always sanitize the parameters you pass. These libraries are used by all of Python's object-relational mappers (such as Django models), so you don't need to worry about sanitation there either.

xss - Sanitising user input using Python - Stack Overflow

python xss
Rectangle 27 6

Jeff Atwood himself described how StackOverflow.com sanitizes user input (in non-language-specific terms) on the Stack Overflow blog: http://blog.stackoverflow.com/2008/06/safe-html-and-xss/

However, as Justin points out, if you use Django templates or something similar then they probably sanitize your HTML output anyway.

SQL injection also shouldn't be a concern. All of Python's database libraries (MySQLdb, cx_Oracle, etc) always sanitize the parameters you pass. These libraries are used by all of Python's object-relational mappers (such as Django models), so you don't need to worry about sanitation there either.

xss - Sanitising user input using Python - Stack Overflow

python xss
Rectangle 27 3

I've been identified as not-human several times by the Stack Overflow blog comment captcha. Now I just keep requesting new captchas until I get one I can read. Usually only takes ~3 tries.

Update: According to Ben Maurer, the Chief Engineer at reCAPTCHA, who commented on my blog about this, over 96% of reCAPTCHAs are solved correctly. So maybe we as a group are just getting dumber?

Are reCAPTCHA CAPTCHAs getting harder or is just me - Stack Overflow

recaptcha
Rectangle 27 33

4) Crediting their bank account with two random amounts and ask them to enter those in. 5) Snail mail them some new password and ask them to enter it in. 6) Have them text or call some number and enter some value to a phone number with the mobile phone they registered on file. 7) Get out of the password management problem altogether by outsourcing it to OpenID providers like Stack Overflow, Facebook, blog engines, and others are starting to do.

Outside of those, use option #1 or #2 with the added feature that both expire in an hour.

I would decrease the validity period to just a few minutes, maybe 510 or so. That should be enough to check the e-mails and change the password.

I don't think it could fit to a community website, because we almost never use your credit card on this kind of website, and that could get bored the new user who is registering. But in some case, it could be useful.

@volumeone If someone gets hold of the e-mails, one would be able to change the password even if it may no longer be relevant.

security - What is the best "forgot my password" method? - Stack Overf...

security md5 application-design forgot-password
Rectangle 27 28

Although I'm honestly not sure if this is am improvement on the older, shorter "code of conduct," if we're going to go the verbose route and expand it, I think there's a glaring omission which is danced around and alluded to, but not actually addressed: New Users.

On the bigger and more mature/older communities, the semi-recent changes to increase visibility in Google has brought in a large volume of new users, and a highly correlated influx of absolute crap masquerading as posts from new users. And, to be fair, we can't blame it all on Google, as a decline in quality (whether real or perceived) and an increase in snippiness have been recurring themes on the meta sites of Server Fault, Stack Overflow and Super User for years.

Experts, the people who give good answers, are the core of any Q&A site. Anyone can ask a good question, but not anyone can give it a good answer - it even says so on the Stack Overflow blog. Without people to give good answers, the community will die, or become another Yahoo! Answers clone. And, as amusing as it is to read many of those train wrecks, that's not what Stack Exchange is supposed to be about. It's supposed to be about high quality questions and answers, which is not a possibility if the experts aren't retained to answer questions.

Frankly, this whole revision to the code of conduct comes off as an admonishment of the existing community (at least to me), and barely recognizes the frustrations that many of us feel that generally cause the community to be less than pink-and-fluffy. That's not right, and it's not beneficial to Stack Exchange as a whole either. When volunteers feel under-appreciated/ignored/disrespected, they stop volunteering. For a network that relies on volunteers to create its content, that's a big deal.

In order to set expectations (or at least have something to point to) and to throw the long-time contributors a bone, there really should be a section in there for new users. At Stack Exchange, there are expectations of new users and questions, and that really ought to be in the code of conduct. I believe that not laying out the fact that there are expectations on new users and posts contributes to the whining and moaning and general butt-hurt expressed by some new members when their garbage gets downvoted and closed.

Off the top of my head, I would suggest something like:

Respect the community. Stack Exchange cultivates communities of experts to provide high-quality answers to your questions. Please be respectful and considerate of their time and expertise, which they donate for free. You can do this by using the site search feature to look for an existing answer, checking the help center for information about community standards and expectations, and looking around a little to make sure you're in the right place before making a contribution.

I think that belittles new users, implies that they're not experts, and that they have a lot to do before they can join that community of experts. None of this is necessarily the case (although there are many users for whom that is true, of course). I agree with your point, I just think it can be said without implying that just because I'm new here, I am in some way inferior to the long-timers.

Generally, new askers aren't experts, and many new answerers aren't either. Perhaps something like "We're glad you want to join the community" might help? That adds an implicit expectation that new participants should at least be aiming for expertise themselves, and gladly includes any who may already have it.

I'm a little thrown by the idea that asking everyone to avoid being rude, belittling, cynical or a jerk is admonishing existing communities - that is not the intent at all. Are some regulars occasionally rough on new people? Yup. But this is even more important for new people, who need to learn how to behave out of the gate. And listing a bunch of the specific things askers should do doesn't really fit that well into the "Be Nice" policy, but we did explicitly add the point that askers should think about how to help answerers help them, be patient, and rememeber they're volunteers here.

@Jaydles it definitely gives the perception of being directed at the existing members, and it creates the implication that we're not doing a good enough job of certain things. (If the existing folks were nice and patient, they wouldn't need to be told to be nice and patient.). As to the bit about new users, thinking about how to best get help is not enough. Posting crap is harmful and wastes the time of everyone who has to read or deal with it, but a lot of new users don't get this. It needs to be said (politely) that low quality and off-topic contributions are prohibited.

@Jaydles Is this being shown to new users upon signup? If not... don't you think that kinda defeats the purpose of this? No new user would ever discover it unless we put it in front of their face -- and even then, they probably won't read it.

@hichris123, once it's finalized, we are planning to look at ways to get it in front of a lot more new users. (We're already working on getting more of them to "tour", which both helps them with the basics, and emphasizes how to ask a better-quality question)

+1 I do think its important to remind people that respect is a two-way street. It's pretty clear from the state of some of the posts we all see at times that not every 'newbie' respects the time and effort of the people they expect to help them. I've got no problem with whatever variation of 'don't be rude' is decided upon but there's a limit to how much respect I have for people who don't respect us.

As a new-ish user myself, I feel this "Be Nice" guide is talking to me also, not only the elites. It sets expectations for engaging and contributing, whether I am a beginner who wants to fit in or an elder who may appreciate the reminder.

If the offered text said anything at all about new users then Paul might have a point, but since it doesn't, he doesn't.

Imho this does not add anything significantly new that is not already expressed in point 2. of the proposed CoC. You want to embrace new users, not scare them away.

@Paul I agree with you - upon reflection, I don't much like the wording either. Someone else would probably be better equipped to write up those sentiments in a friendly/nice, non-patronizing fashion, as I don't think I'm well-equipped to do that.

@JimBalter, the answer clearly is around "New users", as the first paragraph says. And although the offered text doesn't use that term, it clearly indicates that I, the reader, am not (yet?) part of the "community of experts" and this dichotomy is what I was commenting on. The text about looking around before contributing is pretty clearly aimed at newcomers, too.

OMG, some people are experts and some are not ... the horror! And the text doesn't make any such division; experts should respect experts too.

discussion etiquette help-center behavior be-nice-policy
Rectangle 27 610

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 610

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 609

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 609

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 598

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 595

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 595

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 7

Points of reference on Stack Overflow

The behaviour you are experiencing is fully expected. Moreover, it is related to java generics in the same way as to how HTTP works.

<h:selectManyCheckbox>
<input type="checkbox" name="..." value="userRoleAsString">

as strings

request.getParameter("checkboxName");
Role

As you know due to the fact that java chose type erasure for generics to provide for backwards compatibility, information about generic types is basically a compile-type artifact and is lost at runtime. So at runtime your List<Role> erases to a plain, good old List. And as far as EL is a runtime language that uses Java Reflection API to deal with your expressions / call methods, at runtime no such information is available. Taking into account the HTTP part, JSF does its best and assigns string objects to your list, as it's all it can implicitly do. If you are willing to tell JSF to do otherwise, you need to do that explicitly, i.e. by specifying a converter to know what type of object to expect in an HTTP request.

JSF has a provided javax.faces.Enum converter and in indeed works, if EL knew of the compile-time generic type of your list, that is Role. But it doesn't know of it. It would be not necessary to provide for a converter in case your multiple selection would be done on a Role[] userRoles object, or if you used the unique selection like in <h:selectOneMenu> with a value bound to Role userRole. In these examples the built-in enum converter will be called automatically.

So, to get it work as expected you need to provide for a Converter that will 'explain' JSF what type of values does this list hold, and how to do the transformations from Role to String, and vice versa.

It is worth noting that this will be the case with any bound List<...> values within the multiple choice JSF components.

After the problem was examined and resolved I was wondering if no one faced it in the past and searched for some previous answers here. Not surprisingly, it was asked before, and of course the problem was solved by BalusC. Below are two most valuable point of reference:

Below I provide for a test case entirely for your understanding: everything works as expected apart from the third <h:selectManyCheckbox> component. It's up to you to trace it fully to eliminate the issue altogether.

<h:form>
    Many with enum converter
    <!-- will be mapped correctly with Role object -->
    <h:selectManyCheckbox value="#{q16433250Bean.userRoles}" converter="roleEnumConverter">
        <f:selectItems value="#{q16433250Bean.allRoles}" var="role" itemLabel="#{role.name}" />
    </h:selectManyCheckbox>
    <br/>
    Many with plain converter
    <!-- will be mapped correctly with Role object -->
    <h:selectManyCheckbox value="#{q16433250Bean.userRoles2}" converter="roleConverter">
        <f:selectItems value="#{q16433250Bean.allRoles2}" var="role" itemLabel="#{role.name}" />
    </h:selectManyCheckbox>
    <br/>
    Without any converter
    <!-- will NOT be mapped correctly with Role object, but with a default String instead -->
    <h:selectManyCheckbox value="#{q16433250Bean.userRoles3}">
        <f:selectItems value="#{q16433250Bean.allRoles}" var="role" itemLabel="#{role.name}" />
    </h:selectManyCheckbox>
    <br/>
    Without any converter + array
    <!-- will be mapped correctly with Role object -->
    <h:selectManyCheckbox value="#{q16433250Bean.userRoles4}">
        <f:selectItems value="#{q16433250Bean.allRoles}" var="role" itemLabel="#{role.name}" />
    </h:selectManyCheckbox>
    <br/>
    <h:commandButton value="Submit" action="#{q16433250Bean.action}"/>
</h:form>
@ManagedBean
@RequestScoped
public class Q16433250Bean {

    private List<Role> userRoles = new ArrayList<Role>();//getter + setter
    private List<Role> userRoles2 = new ArrayList<Role>();//getter + setter
    private List<Role> userRoles3 = new ArrayList<Role>();//getter + setter
    private Role[] userRoles4;//getter + setter

    public enum Role {

        ADMIN("Admin"),
        SUPER_USER("Super user"),
        USER("User");
        private final String name;

        private Role(String name) {
            this.name = name;
        }

        public String getName() {
            return this.name;
        }
    }

    public Role[] getAllRoles() {
        return Role.values();
    }

    public String action() {
        return null;
    }

}
@FacesConverter("roleEnumConverter")
public class RoleEnumConverter extends EnumConverter {

    public RoleEnumConverter() {
        super(Role.class);
    }

}

and

@FacesConverter("roleConverter")
public class RoleConverter implements Converter {

    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        if(value == null || value.equals("")) {
            return null;
        }
        Role role = Role.valueOf(value);
        return role;
    }

    public String getAsString(FacesContext context, UIComponent component, Object value) {
        if (!(value instanceof Role) || (value == null)) {
            return null;
        }
        return ((Role)value).toString();
    }

}

Shouldn't the standard enum converter do that in JSF 2.0 without explicitly setting it?

Well I know how converters work in general(and how to write them as I already did), but I was mistaken by thinking the standard enum converter would do that for me without any extra work. However this answer is BalusC-like qualitity, thank you :)

You don't need a converter for Java Enum.

java - JSF and type safety - Stack Overflow

java jsf generics classcastexception type-safety