in reply to Stuck in komplexer regex, at least for me
sorry for the bad explanation, i try to explain it better
the following regex will produce this
s/(?<=\d{2})0*(?<=\d{4})0+// output 215000007801 -> 2157801 300000324002 -> 30324002 890000457651 -> 89457651 210004563401 -> 214563401 201045139158 -> 201045139158
these 2 outputs are wrong
201045139158 -> 201045139158
215000007801 -> 2157801
shoud be
215000007801 -> 21507801
201045139158 -> 20145139158
now i try to explain the rule better,counting starts at 0
the 0 , 1 digits shoud be untouched
if the 2 digit is a 0 and the next digit is a 0 remove all 0 untill first non 0
if the 2 digit a 0 and the next is a non 0 remove the 0
if the 3 digit is a 0 and follows by a 0 then remove all 0 except the 0 at 3 digit
if the 3 digit is a 0 and the next digit is a non 0 remove only the 0
if the 4 digit is a 0 remove it and all following 0 untill non 0
i hope that makes it a bit clearer, i know its kinda confusing
kd ultibuzz
i will test the help u all already given tomorrow at office,thx alot
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Stuck in komplexer regex, at least for me
by xicheng (Sexton) on Mar 26, 2007 at 23:05 UTC | |
by ultibuzz (Monk) on Mar 27, 2007 at 06:42 UTC |