On Wed, Jun 24, 2009 at 9:46 PM, DenesL <[email protected]> wrote: > > On Jun 24, 1:21 pm, Kuba Kucharski <[email protected]> wrote: > > I have a string like this: > > > > 66[1,4-6,0] > > > > i want to generate upon this a list like that: > > > > 6610,6611,6612,6613,6614,6615,6616,6617,6618,6619,6640,6641,6642,6643,... > > 6650,6651... > > 6660,6661... > > 6600,6601, > > I fail to see the generation pattern, > what does 66[1,4-6,0] mean?. >
this means 66X where X is 1 or 4 or 5 or 6 or 0 4th digit in my examples of generated strings may be misleading, so please, forget about it now. there is a string: 66[1,4-6,0] but it could be 254[2,3-6] or 2[3-5] what is in between brackets is 1 digit. in the first example it is: 1,0 - that is clear I suppose? 4-6 - which means 4,5,6 also something like: 2-8 - means 2,3,4,5,6,7,8 So I have to generate every possible number that fits this "regexp" for 99[2,3] it will be: 992, 993 for 99[2-4] it will be 992,993,994 for 99[1,3,6-8] it will be 991,993,996,997,998 Is it clear now? I am parsing some "xls" goverment data.. exactly telephone prefixes tables.. I may know the work-around but.. I wonder if there is an elegant solution in python for this. All I can think of is spliting strings, matching for "-", spliting again.. generate list in loops.. This works, but looks ugly. Purpose? : I need to do some matching outside the telephony software(asterisk). I(my function) get the number, like: 992334432 and I need to match this number to a operator going through prefixes... in the goverment data I have a lot of lines like that one: Netia: SPQ=71(1,3-0), SPQ=70(1-3), SP=3(1-3), SPQ=35(1,2,4-6,8,9), SP=4(4-6), SPQ=41(1,3,7,0), SPQ=43(1-4,6-0), SPQM=390(5-0), SP=27, SPQ=47(9,0), SPQM=3880 Where "Netia" is an operator name. So you see... :) I don't expect people to understand my problems ;) Thx for your time. -- Kuba --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

