User talk:Coren/Archives/2013/April
This is an archive of past discussions about User:Coren. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Evil regular expression
So, remember that regular expression about which I talked to you before?
s/\{\|[^*]*\|+([^\{*][^*]*\|+)*\{|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^\{"'\\]*)/defined $2 ? $2 : ""/gse;
I had a hell of a time trying to port it because while Perl's regular expression interpreter seems to manage it just fine (and I have no idea why), other RE interpreters seemed to be choking on it given a seemingly simple input (I tried two Java interpreters, both of which ran for hours before I terminated them, and PHP just segfaulted). Turns out the +)*
makes it an "evil" regular expression (see ReDoS for a description of the problem). I changed it to the following and it actually got the exact same results on 8,244 inputs:
s/\{\|[^*]*\|+([^\{*][^*]*\|+)\{//gs;
Just FYI. I assume even with Perl's regular expression interpreter this will result in a good performance improvement in the normalizewikitext subroutine, and now you know how to avoid potential problems in the future. Cheers, — madman 03:29, 5 April 2013 (UTC)
- By the way, I'm not sure either regular expression actually does what you want it to (if you see what it matches against some wikitables on regexpal.com), but that's another story; I'm just trying to duplicate and test behavior. Cheers, — madman 03:34, 5 April 2013 (UTC)
Ping
Just bringing this to your attention - all I see is that it's a CU block, but I have no further information. m.o.p 06:16, 6 April 2013 (UTC)
- They were caught in a sleeper sweep related to Wikipedia:Sockpuppet investigations/Bigshowandkane64, as far as I can tell. It was several months ago, though, so I don't have much more context than this. — Coren (talk) 14:17, 6 April 2013 (UTC)
- Declined on that basis. Thanks! m.o.p 20:14, 6 April 2013 (UTC)
Hi Coren, I have seen your answer here, but could you change the template in order to make it conditional?, and if you can, include parameters which can be modified in the documentation page. Regards. --JaviP96 22:20, 7 April 2013 (UTC)
- I wouldn't feel comfortable changing the interface to a template that is so widely transcluded without a robust discussion with the community; it's almost impossible to assess the impact such a change might have that isn't clearly obvious. Since this template is actually used by numerous other templates, changing it might adversely impact thousands of pages – it would really be best if you discussed the possible change on its talkpage (where the editors most familiar with it will be in a better position to assess the impact). — Coren (talk) 22:45, 7 April 2013 (UTC)
Discussion you might be interested in
Hi Coren - I'm too tired to try to find your WMF account, but I noted this discussion about the toolserver on VPT, and thought the users there might benefit from some insight you could add. Risker (talk) 05:06, 8 April 2013 (UTC)