On Wed, Jan 10, 2007 at 04:48:54PM +0200, [EMAIL PROTECTED] wrote:
> ke, 2007-01-10 kello 10:30 +0100, Nicolas François kirjoitti:
> > On Wed, Jan 10, 2007 at 10:45:08AM +0200, [EMAIL PROTECTED] wrote:
> > > -=| Nicolas François,  9.01.2007 21:50 |=-
> > > > On Tue, Jan 09, 2007 at 05:55:48PM +0200, [EMAIL PROTECTED] wrote:
> > > >>   # "[EMAIL PROTECTED]" -> "ll_CC.UTF-8"
> > > >>   s/^([a-z]+)_([A-Z]+)(?:\.([EMAIL 
> > > >> PROTECTED])?(?:@euro)?$/$1_$2.UTF-8/;
> > > >>
> > > >>   # "[EMAIL PROTECTED]" -> "[EMAIL PROTECTED]"
> > > >>   s/^([a-z]+)_([A-Z]+)(?:\.([EMAIL PROTECTED])?@(.+)$/[EMAIL 
> > > >> PROTECTED]/;
> > > > 
> > > > And here is the patch for utf8migrationtool.
> > > > 
> > > >      match = sre.match("^(.*?)(\..*)?(@.*)?$", w['Login'].currentLocale)
> > > 
> > > If this was perl regex, only first group will ever match, since perl
> > > regex modifier "*" is "greedy", i.e. it matches as long as possible
> > > before giving up. Not sure how python handles this, but I thought I
> > > better mention it.
> > > 
> > > Also, what is the exact meaning of the first "?" ? "*" already matches
> > > "0 or more" times...
> > 
> > Eheh;) '*?' indicate a non greedy match. IMO it's the same in perl.
> > 
> > But the second group should also be non greedy (it's not important
> > according to the currently SUPPORTED locales, but should be safer).
> > 
> > Martin, can you change the regex to:
> > "^(.*?)(\..*?)?(@.*)?$"
> > 
> > or, if you want to avoid the greedy/non greedy issue:
> > "^([EMAIL PROTECTED])([EMAIL PROTECTED])?(@.*)?$"
> 
> I'm not sure I understand what the issue is about. Wildcard overload.

With the original regex, [EMAIL PROTECTED] is split in only two
groups: ll_CC and [EMAIL PROTECTED]
(the two others are equivalent and split the string in 3 groups: ll_CC,
.CODESET and @modifier)

The only locales which triggers this issue (in the current SUPPORTED file)
have a UTF-8 encoding, and when the encoding is UTF-8, this bloc of code
is not used.
Thus, it would be better to really fix it, but it is not an high priority
issue.

Kind Regards,
-- 
Nekral

Reply via email to