Re: Regular expressions question

2008-10-02 Thread Vlastimil Brom
2008/10/2 aditya shukla <[EMAIL PROTECTED]> > Hello folks , > > I trying to match a pattern in a string , i am new in using re .This is > what is happening > > When i do this > > p = re.compile('(\[&&NHX:)') > >>> m = p.match("[&&NHX:C=0.195.0]") > >>> print m > <_sre.SRE_Match object at 0x013FE1E

Regular expressions question

2008-10-02 Thread aditya shukla
Hello folks , I trying to match a pattern in a string , i am new in using re .This is what is happening When i do this p = re.compile('(\[&&NHX:)') >>> m = p.match("[&&NHX:C=0.195.0]") >>> print m <_sre.SRE_Match object at 0x013FE1E0> --- thus i am able to find the match but when i use the stri

Re: One more regular expressions question

2007-01-18 Thread Neil Cerutti
On 2007-01-18, Victor Polukcht <[EMAIL PROTECTED]> wrote: > My pattern now is: > > (?P[^(]+)(?P\d+)\)\s+(?P\d+) > > And i expect to get: > > var1 = "Unassigned Number " > var2 = "1" > var3 = "32" > > I'm sure my regexp is incorrect, but can't understand where > exactly. Break it up using verbose n

Re: One more regular expressions question

2007-01-18 Thread Daniele Varrazzo
Victor Polukcht wrote: > Great thanks. > > You post helped me so much! > > My resulting regexp is: > "(?P^(.*)\s*)\(((?P\d+))\)\s+((?P\d+))" Notice that this way you are including trailing whitespaces in the var1 group. You may want to put the "\s*" outside the parenthesis. mmm... in this case yo

Re: One more regular expressions question

2007-01-18 Thread Jussi Salmela
Victor Polukcht kirjoitti: > Great thanks. > > You post helped me so much! > > My resulting regexp is: > "(?P^(.*)\s*)\(((?P\d+))\)\s+((?P\d+))" > If it doesn't have to be a regex: #=== s = '''\ Unassigned Number (1)

Re: One more regular expressions question

2007-01-18 Thread Victor Polukcht
Great thanks. You post helped me so much! My resulting regexp is: "(?P^(.*)\s*)\(((?P\d+))\)\s+((?P\d+))" On Jan 18, 2:38 pm, "Daniele Varrazzo" <[EMAIL PROTECTED]> wrote: > Victor Polukcht wrote: > > I have a couple of strings like: > > > Unassigned Number (1)

Re: One more regular expressions question

2007-01-18 Thread harvey . thomas
Victor Polukcht wrote: > My pattern now is: > > (?P[^(]+)(?P\d+)\)\s+(?P\d+) > > And i expect to get: > > var1 = "Unassigned Number " > var2 = "1" > var3 = "32" > > I'm sure my regexp is incorrect, but can't understand where exactly. > > Regex.debug shows that even the first block is incorrect. >

Re: One more regular expressions question

2007-01-18 Thread Daniele Varrazzo
Victor Polukcht wrote: > I have a couple of strings like: > > Unassigned Number (1)32 [...] > Interworking, unspecified (127) 5 > > I need to get: > Error code (value in brackets) - Value - Message. > > My actual problem is i can't get ho

Re: One more regular expressions question

2007-01-18 Thread Victor Polukcht
My pattern now is: (?P[^(]+)(?P\d+)\)\s+(?P\d+) And i expect to get: var1 = "Unassigned Number " var2 = "1" var3 = "32" I'm sure my regexp is incorrect, but can't understand where exactly. Regex.debug shows that even the first block is incorrect. Thanks in advance. On Jan 18, 1:15 pm, Robert

Re: One more regular expressions question

2007-01-18 Thread Peter Otten
Victor Polukcht wrote: > I have a couple of strings like: > > Unassigned Number (1)32 > No Route To Destination (3) 12 > Normal call clearing (16) 2654 > User busy (17)

Re: One more regular expressions question

2007-01-18 Thread Roberto Bonvallet
Victor Polukcht wrote: > My actual problem is i can't get how to include space, comma, slash. Post here what you have written already, so we can tell you what the problem is. -- Roberto Bonvallet -- http://mail.python.org/mailman/listinfo/python-list

One more regular expressions question

2007-01-18 Thread Victor Polukcht
I have a couple of strings like: Unassigned Number (1)32 No Route To Destination (3) 12 Normal call clearing (16) 2654 User busy (17) 630 No user respo

Re: Regular expressions question

2007-01-16 Thread Victor Polukcht
Great thnx. It works. On Jan 16, 6:02 pm, Wolfgang Grafen <[EMAIL PROTECTED]> wrote: > Victor Polukcht wrote: > > I have 2 strings: > > > "Global etsi3 *200 ok30 100% 100% > > Outgoing" > > and > > "Global etsi3 * 4 ok 30 100% 100% > >

Re: Regular expressions question

2007-01-16 Thread Jussi Salmela
Victor Polukcht kirjoitti: > I have 2 strings: > > "Global etsi3 *200 ok30 100% 100% > Outgoing" > and > "Global etsi3 * 4 ok 30 100% 100% > Outgoing" > > The difference is "*200" instead of "* 4". Is there ability to write a > regula

Re: Regular expressions question

2007-01-16 Thread Wolfgang Grafen
Victor Polukcht wrote: > I have 2 strings: > > "Global etsi3 *200 ok30 100% 100% > Outgoing" > and > "Global etsi3 * 4 ok 30 100% 100% > Outgoing" > > The difference is "*200" instead of "* 4". Is there ability to write a > regular ex

Re: Regular expressions question

2007-01-16 Thread Neil Cerutti
On 2007-01-16, Victor Polukcht <[EMAIL PROTECTED]> wrote: > On Jan 16, 5:40 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> On 2007-01-16, Victor Polukcht <[EMAIL PROTECTED]> wrote: >> >> > Actually, i'm trying to get the values of first field (Global) , fourth >> > (200, 4), and fifth (100%) and si

Re: Regular expressions question

2007-01-16 Thread Victor Polukcht
The same regular expression should work for another string (with *200). On Jan 16, 5:40 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-01-16, Victor Polukcht <[EMAIL PROTECTED]> wrote: > > > Actually, i'm trying to get the values of first field (Global) , fourth > > (200, 4), and fifth (100

Re: Regular expressions question

2007-01-16 Thread Neil Cerutti
On 2007-01-16, Victor Polukcht <[EMAIL PROTECTED]> wrote: > Actually, i'm trying to get the values of first field (Global) , fourth > (200, 4), and fifth (100%) and sixth (100%). > > Everything except fourth is simple. >>> g = "Global etsi3 * 4 ok 30 100% 100% Outgoing" >>> impo

Re: Regular expressions question

2007-01-16 Thread Victor Polukcht
Actually, i'm trying to get the values of first field (Global) , fourth (200, 4), and fifth (100%) and sixth (100%). Everything except fourth is simple. On Jan 16, 2:59 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Victor Polukcht" <[EMAIL PROTECTED]> wrote: > > I have 2 strings: > > > "Global

Re: Regular expressions question

2007-01-16 Thread Duncan Booth
"Victor Polukcht" <[EMAIL PROTECTED]> wrote: > I have 2 strings: > > "Global etsi3 *200 ok30 100% 100% > Outgoing" > and > "Global etsi3 * 4 ok 30 100% 100% > Outgoing" > > The difference is "*200" instead of "* 4". Is there ability

Regular expressions question

2007-01-16 Thread Victor Polukcht
I have 2 strings: "Global etsi3 *200 ok30 100% 100% Outgoing" and "Global etsi3 * 4 ok 30 100% 100% Outgoing" The difference is "*200" instead of "* 4". Is there ability to write a regular expression that will match both of that strin