Message143333
I tried to run a test suite of 3kloc (not just about regex, but regex were used in several places) and I had only one failure:
>>> s = u'void foo ( type arg1 [, type arg2 ] )'
>>> re.sub('(?<=[][()]) |(?!,) (?!\[,)(?=[][(),])', '', s)
u'void foo(type arg1 [, type arg2])'
>>> regex.sub('(?<=[][()]) |(?!,) (?!\[,)(?=[][(),])', '', s)
u'void foo ( type arg1 [, type arg2 ] )'
Note than when the two patterns are used independently they both yield the same result on re and regex, but once they are combined the result is different:
>>> re.sub('(?<=[][()]) ', '', s)
u'void foo (type arg1 [, type arg2 ])'
>>> regex.sub('(?<=[][()]) ', '', s)
u'void foo (type arg1 [, type arg2 ])'
>>> re.sub('(?!,) (?!\[,)(?=[][(),])', '', s)
u'void foo( type arg1 [, type arg2])'
>>> regex.sub('(?!,) (?!\[,)(?=[][(),])', '', s)
u'void foo( type arg1 [, type arg2])' |
|
Date |
User |
Action |
Args |
2011-09-01 17:13:07 | ezio.melotti | set | recipients:
+ ezio.melotti, loewis, georg.brandl, gregory.p.smith, jimjjewett, sjmachin, amaury.forgeotdarc, belopolsky, pitrou, nneonneo, giampaolo.rodola, rsc, timehorse, mark, vbr, mrabarnett, jaylogan, akitada, moreati, steven.daprano, alex, r.david.murray, jacques, zdwiel, jhalcrow, stiv, davide.rizzo, ronnix, eric.snow, akoumjian |
2011-09-01 17:13:07 | ezio.melotti | set | messageid: <1314897187.16.0.260921766823.issue2636@psf.upfronthosting.co.za> |
2011-09-01 17:13:06 | ezio.melotti | link | issue2636 messages |
2011-09-01 17:13:06 | ezio.melotti | create | |
|