« first day (4481 days earlier)      last day (464 days later) » 

12:00 AM
There is never time to do it right, but always time to do it over. (source)
 
@SergeyZolotarev Not sure what you consider identical in this context
The statement you included is equivalent to i = (object.method() != -1), at least assuming the second ) after method() is a typo
(object.method() != -1) is a boolean, so if i is an integer, it will fail
If, however, you have (i = object.method()) != -1, which does require explicit parentheses because operator precedence, whereever you place the statement has to take a boolean
The latter case is evaluated like this: first, i = object.method() is set. Because Java:tm:, for future evaluation purposes, the result of that statement is the value of i after assignment, which is then compared to -1 to yield a final boolean
 
Why does it match a space?
A colon, a space, a parenthesis – all of those are examples of non-word characters. This regex is not supposed to match one non-word character in the middle of others
 
12:16 AM
It isn't matching any characters
(T is an example of a non-word and a word character
It matches the zero-width gap between the two, because you don't actually have any matching groups
 
@ZoestandswithUkraine isn't that first pale dot a match?
 
No, that's just how regex101 renders spaces
The purple lines are the zero-width matches
it's a fairly standard rendering convention that primarily appears in places where the type of whitespace matters
There's also an equivalent highlight for tabs:
 
@ZoestandswithUkraine 🙏
@ZoestandswithUkraine I meant this, by the way. But now I realize it simply had parentheses put in the right place. I started to suspect InputStreams may have slightly different syntax rules
 
@SergeyZolotarev No, just plain evaluation order
 
12:42 AM
Bonus question: how are pale matches different from bright ones?
Do brightly-colored matches mean that more than one pattern applies to it?
 
 
2 hours later…
2:20 AM
I can't use regex in regular Strings, can I?
 
 
2 hours later…
3:50 AM
Why does it throw?
 
 
12 hours later…
3:51 PM
fights crime
 
4:25 PM
@SergeyZolotarev because ) is a special character in regexes so you need to escape it
:\\s*\\) or something like that
 
 
6 hours later…
10:33 PM
@dan1st 🙏
It looks pretty much static to me. What's wrong?
 
11:16 PM
Gosh, is there a single person on this planet that can explain Java generics to me in a way that I can understand...
 

« first day (4481 days earlier)      last day (464 days later) »