« first day (885 days earlier)      last day (2907 days later) » 

9:49 AM
...
 
10:44 AM
@hwnd: I think bash regex is a source of madness, which is not well-covered on StackOverflow
It relies on locale and may resolve collation, which means that [a-z] may include more than the familiar English alphabet
I currently on system where [a-z] can match assccÑasas
Test code: [[ "assccÑasas" =~ ([a-Z]*) ]] && echo "${BASH_REMATCH[1]}"
 
11:04 AM
@nhahtdh You're still fighting? I moved on. All the best!
 
11:21 AM
@Unihedron I only downvote and close vote shit question at most, and it's still time consuming
 
11:48 AM
hi
 
@deadlydragon00 hi
 
Hi.
 
hi @uni @Ham , oh your here also @Jerry
 
yo
yea
 
12:33 PM
Hello! I wonder why pattern like (?: |\G)\d\B\K and replace with * gives different results in regex101 and preg_replace or at least PHP 5.5.14 at eval.in where it converts to 1*23 a123 1*23*45*67 b123 1*23 but expected is 1*2*3 a123 1*2*3*4*5*6*7 b123 1*2*3 I know can be done easily without \K but want to know, what's not working or have short circuit :]
 
 
3 hours later…
3:07 PM
@Jonny5 You should write it as (?:\G|(?<=^|\h)\d(?=\d))\K\B eval.in/414858
@nhahtdh That is weird, it says the sorting order of characters in range expressions is determined by the current locale and the values of the LC_COLLATE and LC_ALL shell variables, if set. That other locales might interpret "[a-cx-z]" as "[aBbCcXxYyZz]" if sorting is done in dictionary order. If you want to be sure to have the traditional interpretation of ranges, force this behavior by setting LC_COLLATE or LC_ALL to "C"
 
@hwnd Thanks for your effort! Yes that works, but I wonder why the other one does not work with preg_replace.
Evening from my balcony :p good night :]
 
 
4 hours later…
7:00 PM
@hwnd Yeah, I think the locale on the system I run the test was en_US.utf8, if I remember correctly. A consequence of that is that if the characters with accents are ordered between the characters in English alphabet, then they are included in the character class
 
7:11 PM
@Jonny5 Probably a bug in PHP?
I guess it is a bump along bug, since the match is empty
Ah, I know what is going on here now.
Use the 2nd match in regex101 for example.
In PHP, the first match is empty string, so it restarts the next match from the same position and forces the next match to be the empty string.
However, the problem is the "same position" part
It doesn't store the position where it starts the match. Instead it takes the position from the match array
So it forces the next match to start from index 1 to be non-empty, which fails
The offending piece of code: github.com/php/php-src/blob/…
@Jonny5 (Please file a bug on PHP bug tracker, then I will comment there)
hwnd's regex doesn't suffer from the problem, because the "inside" matches start and end at the same position
Yours suffer from the problem, since "inside" matches start and end at difference place, but the start index is hidden by \K
 
7:36 PM
@nhahtdh and there is no way to change the order I suppose.
 
^Which one of my comment are you replying to?
 
The locale settings
 
@hwnd The order is predefined based on locale, so yeah
 
Yea that's what I figured
 
You can edit the locale file, but I don't know what would happen to the rest of the programs if you do that
(It's also possible to define your own locale this way)
 
7:43 PM
If you try editing, I would just backup the original =)
I'm interested to know if it would work like that.
 
I'm quite sure it would
@Jonny5 As for the problem above, my solution is as followed: regex101.com/r/oP9mZ7/4
Regex: ((?:\G|\b)\d)\B Replacement $1*
 

« first day (885 days earlier)      last day (2907 days later) »