Re: help on python regular expression named group

2013-07-17 Thread wxjmfauth
Le mercredi 17 juillet 2013 09:46:46 UTC+2, Joshua Landau a écrit : > On 17 July 2013 07:15, wrote: > > > Not sure, I'm correct. I took you precise string to > > > refresh my memory. > > > > I'm glad to see you doing something else, but I don't think you > > understood his problem. Note tha

Re: help on python regular expression named group

2013-07-17 Thread Joshua Landau
On 17 July 2013 07:15, wrote: > Not sure, I'm correct. I took you precise string to > refresh my memory. I'm glad to see you doing something else, but I don't think you understood his problem. Note that his problem has not solution, which a few seconds of Googling has confirmed to me. -- http:/

Re: help on python regular expression named group

2013-07-16 Thread wxjmfauth
Le mardi 16 juillet 2013 08:55:58 UTC+2, Mohan L a écrit : > Dear All, > > > > Here is my script : > > > > #!/usr/bin/python > > > import re > > > > > # A string. > logs = "date=2012-11-28 time=21:14:59" > > > > # Match with named groups. > m = > re.match("(?P(date=(?P[^\s]+))\s+(ti

Re: help on python regular expression named group

2013-07-16 Thread Joshua Landau
On 16 July 2013 16:38, MRAB wrote: > On 16/07/2013 11:18, Mohan L wrote: >> >> I using another third party python script. It takes the regex from >> configuration file. I can't write any code. I have to do all this in >> single regex. >> > A capture group captures a single substring. > > What you'

Re: help on python regular expression named group

2013-07-16 Thread MRAB
On 16/07/2013 11:18, Mohan L wrote: On Tue, Jul 16, 2013 at 2:12 PM, Joshua Landau mailto:jos...@landau.ws>> wrote: On 16 July 2013 07:55, Mohan L mailto:l.mohan...@gmail.com>> wrote: > > Dear All, > > Here is my script : > > #!/usr/bin/python > import r

Re: help on python regular expression named group

2013-07-16 Thread Mohan L
On Tue, Jul 16, 2013 at 2:12 PM, Joshua Landau wrote: > On 16 July 2013 07:55, Mohan L wrote: > > > > Dear All, > > > > Here is my script : > > > > #!/usr/bin/python > > import re > > > > # A string. > > logs = "date=2012-11-28 time=21:14:59" > > > > # Match with named groups. > > m = > > > re.m

Re: help on python regular expression named group

2013-07-16 Thread Joshua Landau
On 16 July 2013 07:55, Mohan L wrote: > > Dear All, > > Here is my script : > > #!/usr/bin/python > import re > > # A string. > logs = "date=2012-11-28 time=21:14:59" > > # Match with named groups. > m = > re.match("(?P(date=(?P[^\s]+))\s+(time=(?P[^\s]+)))", > logs) > > # print > print m.groupdic

help on python regular expression named group

2013-07-16 Thread Mohan L
Dear All, Here is my script : #!/usr/bin/python import re # A string. logs = "date=2012-11-28 time=21:14:59" # Match with named groups. m = re.match("(?P(date=(?P[^\s]+))\s+(time=(?P[^\s]+)))", logs) # print print m.groupdict() Output: {'date': '2012-11-28', 'datetime': '*date=2012-

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Evan Driscoll
On 1/25/2012 20:24, Devin Jeanpierre wrote: > If all you're going to change is the parser, maybe it'd be easier to > get things to coexist if parsers were pluggable in the re module. > > It's more generally useful, too. Would let re gain a PyParsing/SNOBOL > like expression "syntax", for example. O

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Steven D'Aprano
On Wed, 25 Jan 2012 13:17:11 -0700, Ian Kelly wrote: > 2) Permitting flags in the regular expression allows different > combinations of flags to be in effect for different parts of complex > regular expressions. You can't do that just by passing in the flags as > an argument. I don't believe Pyt

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Steven D'Aprano
On Wed, 25 Jan 2012 15:44:35 -0800, Rick Johnson wrote: > I've posted my thoughts and my initial syntax. You (and everyone else) > are free to critic or offer suggestions of your own. Listen, none of > these issues that plague Python are going to be resolved until people > around here set aside th

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Rick Johnson
On Jan 25, 8:24 pm, Devin Jeanpierre wrote: > On Wed, Jan 25, 2012 at 7:14 PM, Rick Johnson > > wrote: > > It is germane in the fact that i believe PyParsing, re, and my new > > regex module can co-exist in harmony. > > If all you're going to change is the parser, maybe it'd be easier to > get th

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Devin Jeanpierre
On Wed, Jan 25, 2012 at 7:14 PM, Rick Johnson wrote: > It is germane in the fact that i believe PyParsing, re, and my new > regex module can co-exist in harmony. If all you're going to change is the parser, maybe it'd be easier to get things to coexist if parsers were pluggable in the re module.

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Michael Torrie
On 01/25/2012 06:54 PM, Steven D'Aprano wrote: > The only intuitive interface is the nipple. Everything else is learned. I think young mothers would even disagree with that. It's learned just like everything else in life. Albeit very rapidly. -- http://mail.python.org/mailman/listinfo/python-li

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Steven D'Aprano
On Wed, 25 Jan 2012 16:14:09 -0800, Rick Johnson wrote: > It is germane in the fact that i believe PyParsing, re, and my new regex > module can co-exist in harmony. You don't have a new regex module. When you have written it, then you will have a new regex module. Until then, you're all talk.

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Steven D'Aprano
On Wed, 25 Jan 2012 09:16:01 -0800, Rick Johnson wrote: > In particular i find the "extension notation" syntax to be woefully > inadequate. You should be able to infer the action of the extension > syntax intuitively, simply from looking at its signature. I find myself > continually needing to con

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Rick Johnson
On Jan 25, 5:36 pm, Ian Kelly wrote: > On Wed, Jan 25, 2012 at 2:19 PM, Rick Johnson > > wrote: > > I disagree here. > > Whist some people may be "die-hard" fans of the un-intuitive perl > > regex syntax, i believe many, if not exponentially MORE people would > > like to have a better alternative

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Rick Johnson
On Jan 25, 5:28 pm, Devin Jeanpierre wrote: > Perhaps you should perform some experiments to prove intuitiveness [of your > syntax]? I've posted my thoughts and my initial syntax. You (and everyone else) are free to critic or offer suggestions of your own. Listen, none of these issues that plagu

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Ian Kelly
On Wed, Jan 25, 2012 at 2:19 PM, Rick Johnson wrote: > I disagree here. > Whist some people may be "die-hard" fans of the un-intuitive perl > regex syntax, i believe many, if not exponentially MORE people would > like to have a better alternative. Do i want to remove the current > "well establishe

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Devin Jeanpierre
On Wed, Jan 25, 2012 at 12:16 PM, Rick Johnson wrote: > In particular i find the "extension notation" syntax to be woefully > inadequate. You should be able to infer the action of the extension > syntax intuitively, simply from looking at its signature. This is nice in theory. I see no reason to

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Devin Jeanpierre
On Wed, Jan 25, 2012 at 2:32 PM, Duncan Booth wrote: > The problem with your idea is that it breaks compatability with other non- > Python regular expression engines. Python didn't invent the (?...) syntax, > it originated with Perl. > > Try complaining to a Perl group inst

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Rick Johnson
module provides regular expression matching operations *similar > >> to those found in Perl*" (my emphasis). ÿThe goal here is > >> compatibility with existing RE syntaxes, not readability. ÿPerl uses > >> the (?...) syntax, so the re module does too. > > > @Dunca

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Duncan Booth
t;> to those found in Perl*" (my emphasis). ÿThe goal here is >> compatibility with existing RE syntaxes, not readability. ÿPerl uses >> the (?...) syntax, so the re module does too. > > @Duncan and Ian: > Did you not read the title of my post? :o) " Python regular e

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Rick Johnson
is).  The goal here is > compatibility with existing RE syntaxes, not readability.  Perl uses > the (?...) syntax, so the re module does too. @Duncan and Ian: Did you not read the title of my post? :o) " Python regular expression syntax is not intuitive." While i understand WHERE the syntax

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Terry Reedy
On 1/25/2012 12:16 PM, Rick Johnson wrote: (?...) # Base Extension Syntax All extensions are wrapped in parenthesis and start with a question mark, but i believe the question mark was a very bad choice, since the I think that syntax came either from Perl or the pcre library used by several o

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Ian Kelly
On Wed, Jan 25, 2012 at 10:16 AM, Rick Johnson wrote: > (?...)  # Base Extension Syntax > All extensions are wrapped in parenthesis and start with a question > mark, but i believe the question mark was a very bad choice, since the > question mark is already specific to "zero or one repetitions of

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Duncan Booth
another char, and the char should NOT be known to RE in any > other place. Maybe the tilde would work? Wait, i have a MUCH better > idea!!! The problem with your idea is that it breaks compatability with other non- Python regular expression engines. Python didn't invent the (?...) sy

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Rick Johnson
On Jan 25, 11:16 am, Rick Johnson wrote: > {!()...} or (!...) # Non Capturing. Yuck: on second thought, i don't like {!()...}, mainly because non- capturing groups should use the parenthesis delimiters to keep the API consistent. Try this instead --> (!:...) > {NG=identifier...}  # Named Group

PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Rick Johnson
In particular i find the "extension notation" syntax to be woefully inadequate. You should be able to infer the action of the extension syntax intuitively, simply from looking at its signature. I find myself continually needing to consult the docs because of the lacking or misleading style of the c

Re: Need help in Python regular expression

2009-06-12 Thread Rhodri James
On Fri, 12 Jun 2009 06:20:24 +0100, meryl wrote: On Jun 11, 9:41 pm, "Mark Tolonen" wrote: "meryl" wrote in message > Hi, > I have this regular expression > blockRE = re.compile(".*RenderBlock {\w+}") > it works if my source is "RenderBlock {CENTER}". [snip] ---cod

Re: Need help in Python regular expression

2009-06-12 Thread Jean-Michel Pichavant
To the OP, I suggest if you haven't yet Kodos, to get it here http://kodos.sourceforge.net/. It's a python regexp debugger, a lifetime saver. Jean-Michel John S wrote: On Jun 11, 10:30 pm, meryl wrote: Hi, I have this regular expression blockRE = re.compile(".*RenderBlock {\w+}") it w

Re: Need help in Python regular expression

2009-06-12 Thread Vlastimil Brom
2009/6/12 meryl : > On Jun 11, 9:41 pm, "Mark Tolonen" wrote: >> "meryl" wrote in message >> >> > I have this regular expression >... > I try adding ".*" at the end , but it ends up just matching the second > one. If there can be more matches in a line, maybe the non-greedy quantifier ".*?", a

Re: Need help in Python regular expression

2009-06-11 Thread meryl
On Jun 11, 9:41 pm, "Mark Tolonen" wrote: > "meryl" wrote in message > > news:2d4d8624-043b-4f5f-ae2d-bf73bca3d...@p6g2000pre.googlegroups.com... > > > > > > > Hi, > > > I have this regular expression > > blockRE = re.compile(".*RenderBlock {\w+}") > > > it works if my source is "RenderBlock {CEN

Re: Need help in Python regular expression

2009-06-11 Thread John S
On Jun 11, 10:30 pm, meryl wrote: > Hi, > > I have this regular expression > blockRE = re.compile(".*RenderBlock {\w+}") > > it works if my source is "RenderBlock {CENTER}". > > But I want it to work with > 1. RenderTable {TABLE} > > So i change the regexp to re.compile(".*Render[Block|Table] {\w+

Re: Need help in Python regular expression

2009-06-11 Thread Mark Tolonen
"meryl" wrote in message news:2d4d8624-043b-4f5f-ae2d-bf73bca3d...@p6g2000pre.googlegroups.com... Hi, I have this regular expression blockRE = re.compile(".*RenderBlock {\w+}") it works if my source is "RenderBlock {CENTER}". But I want it to work with 1. RenderTable {TABLE} So i change the

Need help in Python regular expression

2009-06-11 Thread meryl
Hi, I have this regular expression blockRE = re.compile(".*RenderBlock {\w+}") it works if my source is "RenderBlock {CENTER}". But I want it to work with 1. RenderTable {TABLE} So i change the regexp to re.compile(".*Render[Block|Table] {\w+}"), but that breaks everything 2. RenderBlock (CENT

Re: python -regular expression - list element

2008-06-25 Thread Matimus
On Jun 25, 2:55 am, antar2 <[EMAIL PROTECTED]> wrote: > Hello, > > I am a beginner in Python and am not able to use a list element for > regular expression, substitutions. > > list1 = [ 'a', 'o' ] > list2 = ['star',  'day', 'work', 'hello'] > > Suppose that I want to substitute the vowels from list

Re: python -regular expression - list element

2008-06-25 Thread Chris
On Jun 25, 12:32 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > antar2 <[EMAIL PROTECTED]> writes: > > for x in list1: > >    re.compile(x) > >    for y in list2: > >            re.compile(y) > >            if x in y: > >                    z = re.sub(x, 'u', y) > > but this does not work > > You need

Re: python -regular expression - list element

2008-06-25 Thread A.T.Hofkamp
On 2008-06-25, antar2 <[EMAIL PROTECTED]> wrote: > I am a beginner in Python and am not able to use a list element for > regular expression, substitutions. > > list1 = [ 'a', 'o' ] > list2 = ['star', 'day', 'work', 'hello'] > > Suppose that I want to substitute the vowels from list2 that are in >

Re: python -regular expression - list element

2008-06-25 Thread Ben Finney
antar2 <[EMAIL PROTECTED]> writes: > for x in list1: >re.compile(x) > for y in list2: >re.compile(y) > if x in y: > z = re.sub(x, 'u', y) > but this does not work You need to frotz the hymangirator with spangule. That, or show us the actu

Re: python -regular expression - list element

2008-06-25 Thread cokofreedom
On Jun 25, 11:55 am, antar2 <[EMAIL PROTECTED]> wrote: > Hello, > > I am a beginner in Python and am not able to use a list element for > regular expression, substitutions. > > list1 = [ 'a', 'o' ] > list2 = ['star', 'day', 'work', 'hello'] > > Suppose that I want to substitute the vowels from lis

python -regular expression - list element

2008-06-25 Thread antar2
Hello, I am a beginner in Python and am not able to use a list element for regular expression, substitutions. list1 = [ 'a', 'o' ] list2 = ['star', 'day', 'work', 'hello'] Suppose that I want to substitute the vowels from list2 that are in list1, into for example 'u'. In my substitution, I shou

Re: python regular expression help

2007-04-12 Thread Qilong Ren
python regular expression help En Wed, 11 Apr 2007 23:14:01 -0300, Qilong Ren <[EMAIL PROTECTED]> escribió: > Thanks for reply. That actually is not what I want. Strings I am dealing > with may look like this: > s = 'a = 4.5 b = 'h' 'd' c = 4.5 3.5'

Re: python regular expression help

2007-04-12 Thread 7stud
On Apr 11, 11:15 pm, [EMAIL PROTECTED] wrote: > On Apr 11, 9:50 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > lhs = re.compile(r'\s*(\b\w+\s*=)') > for s in [ "a = 4 b =3.4 5.4 c = 4.5", > "a = 4.5 b = 'h' 'd' c = 4.5 3.5"]: > tokens = lhs.split(s) > results = [tokens[_] + tokens[_+1] for

Re: python regular expression help

2007-04-11 Thread Paul McGuire
On Apr 11, 11:50 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 11 Apr 2007 23:14:01 -0300, Qilong Ren <[EMAIL PROTECTED]> > escribió: > > > Thanks for reply. That actually is not what I want. Strings I am dealing > > with may look like this: > > s = 'a = 4.5 b = 'h' 'd' c =

Re: python regular expression help

2007-04-11 Thread attn . steven . kuo
On Apr 11, 9:50 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 11 Apr 2007 23:14:01 -0300, Qilong Ren <[EMAIL PROTECTED]> > escribió: > > > Thanks for reply. That actually is not what I want. Strings I am dealing > > with may look like this: > > s = 'a = 4.5 b = 'h' 'd' c = 4.5

Re: python regular expression help

2007-04-11 Thread 7stud
On Apr 11, 10:50 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 11 Apr 2007 23:14:01 -0300, Qilong Ren <[EMAIL PROTECTED]> > escribió: > > > Thanks for reply. That actually is not what I want. Strings I am dealing > > with may look like this: > > s = 'a = 4.5 b = 'h' 'd' c =

Re: python regular expression help

2007-04-11 Thread Qilong Ren
mes = re.compile(r'(\w+)\s*=').findall(s) the corresponding values values = re.split(r'\w+\s*=',s)[1:] It dose not look good but it works. What do you think? Thanks,Qilong - Original Message From: 7stud <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sent: Wedn

Re: python regular expression help

2007-04-11 Thread Gabriel Genellina
En Wed, 11 Apr 2007 23:14:01 -0300, Qilong Ren <[EMAIL PROTECTED]> escribió: > Thanks for reply. That actually is not what I want. Strings I am dealing > with may look like this: > s = 'a = 4.5 b = 'h' 'd' c = 4.5 3.5' > What I want is > a = 4.5 > b = 'h' 'd' > c = 4.5 3.5

Re: python regular expression help

2007-04-11 Thread 7stud
On Apr 11, 7:41 pm, liupeng <[EMAIL PROTECTED]> wrote: > pattern = re.compile(r'\w+\s*=\s*[0-9]*.[0-9]*\s*') > lists = pattern.findall(s) > print lists > ['a=4 ', 'b=3.4 ', 'c=4.5'] > > On Wed, Apr 11, 2007 at 06:10:07PM -0700, Qilong Ren wrote: > > Hi, everyone, > > > I am extracting some informat

Re: python regular expression help

2007-04-11 Thread Qilong Ren
From: liupeng <[EMAIL PROTECTED]> To: python-list@python.org Sent: Wednesday, April 11, 2007 6:41:30 PM Subject: Re: python regular expression help pattern = re.compile(r'\w+\s*=\s*[0-9]*.[0-9]*\s*') lists = pattern.findall(s) print lists ['a=4 ', 'b=3.4 ', 'c=

Re: python regular expression help

2007-04-11 Thread liupeng
pattern = re.compile(r'\w+\s*=\s*[0-9]*.[0-9]*\s*') lists = pattern.findall(s) print lists ['a=4 ', 'b=3.4 ', 'c=4.5'] On Wed, Apr 11, 2007 at 06:10:07PM -0700, Qilong Ren wrote: > Hi, everyone, > > I am extracting some information from a given string using python RE. The > string is ,for example,

python regular expression help

2007-04-11 Thread Qilong Ren
Hi, everyone, I am extracting some information from a given string using python RE. The string is ,for example, s = 'a = 4 b =3.4 5.4 c = 4.5' What I want is : a = 4 b = 3.4 5.4 c = 4.5 Right now I use : pattern = re.compile(r'\w+\s*=\s*.*?\s+') lists = pattern.findall(s) It

Re: Python regular expression

2006-12-05 Thread Roberto Bonvallet
Wehrdamned wrote: > As I understand it, python uses a pcre engine to work with regular > expression. [...] > My question is, then, why expressions like : re.compile('asd|(?-i:QWE)', re.I) [...] > don't work? They are ok in perl... >From http://docs.python.org/lib/module-re.html: This mo

Python regular expression

2006-12-05 Thread Wehrdamned
Hi, As I understand it, python uses a pcre engine to work with regular expression. My question is, then, why expressions like : >>> re.compile('asd|(?-i:QWE)', re.I) Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/sre.py", line 180, in compile return _com

Re: Python regular expression question!

2006-09-20 Thread unexpected
Sweet! Thanks so much! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python regular expression question!

2006-09-20 Thread Ant
unexpected wrote: > > \b matches the beginning/end of a word (characters a-zA-Z_0-9). > > So that regex will match e.g. MULTX-FOO but not MULTX-. > > > > So is there a way to get \b to include - ? No, but you can get the behaviour you want using negative lookaheads. The following regex is effecti

Re: Python regular expression question!

2006-09-20 Thread unexpected
> \b matches the beginning/end of a word (characters a-zA-Z_0-9). > So that regex will match e.g. MULTX-FOO but not MULTX-. > So is there a way to get \b to include - ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python regular expression question!

2006-09-20 Thread Hallvard B Furuseth
"unexpected" <[EMAIL PROTECTED]> writes: > I'm trying to do a whole word pattern match for the term 'MULTX-' > > Currently, my regular expression syntax is: > > re.search(('^')+(keyword+'\\b') \b matches the beginning/end of a word (characters a-zA-Z_0-9). So that regex will match e.g. MULTX-FOO

Python regular expression question!

2006-09-20 Thread unexpected
I'm trying to do a whole word pattern match for the term 'MULTX-' Currently, my regular expression syntax is: re.search(('^')+(keyword+'\\b') where keyword comes from a list of terms. ('MULTX-' is in this list, and hence a keyword). My regular expression works for a variety of different keyword

Re: How to use python regular expression to substitute string value

2006-02-26 Thread Pasi Savolainen
[EMAIL PROTECTED] writes: > When I try your idea, I have this error > > x, y, width, height = re.findall(pattern, str)[0] > IndexError: list index out of range > > How can I use findall to handle error case? i.e. what if there is no > match? how can I handle it gracefully? This is explained i

Re: How to use python regular expression to substitute string value

2006-02-26 Thread Allerdyce . John
When I try your idea, I have this error x, y, width, height = re.findall(pattern, str)[0] IndexError: list index out of range How can I use findall to handle error case? i.e. what if there is no match? how can I handle it gracefully? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use python regular expression to substitute string value

2006-02-26 Thread Crutcher
Are you sure node.data contains newlines? You could try just: print node.data print node.data.split('\n') This should give you an idea. From the interpreter: >>> s = """ ... abc ... def ... xyz""" >>> s.split('\n') ['', 'abc', 'def', 'xyz'] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use python regular expression to substitute string value

2006-02-26 Thread Allerdyce . John
okay, but I have a simpler question, how can I split using only "\n"? I try this: strings = node.data.split("\n"); print node.data for str in strings: print str where node.data has multiple lines, but in the for loop, I don't see str gets pr

Re: How to use python regular expression to substitute string value

2006-02-26 Thread Crutcher
You don't really need regexes for this. Assuming there is no whitespace in any of your values, it should be really easy to parse the string. s = 'x:11 y:0 w:760 h:19 area:14440 areaPerCent:0 totalAreaPerCent:-3.08011e+16 type:3 path:///-/1/1' s.split() # break the string on whitespace > ['x:11',

Re: How to use python regular expression to substitute string value

2006-02-26 Thread Allerdyce . John
Thanks. But i don't understand why I need to do this: x. . area = map (lambda x: int(x), re.findall (pattern, line)[0] if i have the value already by doing this: x, y, width, height, area = re.findall(pattern, line)[0] print "rect x=\"%(x)s\" y=\"%(y)s\" width=\"%(width)s\" height=\"%(height)s\"

Re: How to use python regular expression to substitute string value

2006-02-26 Thread Pasi Savolainen
[EMAIL PROTECTED] writes: > Hi, > I am new to python. I would like to know how to use python regular > expression to substitute string value? > I have an input string like this: > x:11 y:0 w:760 h:19 area:14440 areaPerCent:0 > totalAreaPerCent:-3.08011e+16 type:3 path:///-/1

How to use python regular expression to substitute string value

2006-02-26 Thread Allerdyce . John
Hi, I am new to python. I would like to know how to use python regular expression to substitute string value? I have an input string like this: x:11 y:0 w:760 h:19 area:14440 areaPerCent:0 totalAreaPerCent:-3.08011e+16 type:3 path:///-/1/1 and I would like to convert it to: rect x="11&

Re: where to find the doc about python regular expression?

2005-06-02 Thread Klaus Alexander Seistrup
ÒÊÃÉɽÈË wrote: > thanks Did you try Google: First hit is: -- Klaus Alexander Seistrup Magnetic Ink, Copenhagen, Denmark http://magnetic-ink.dk/ -- http://mail.python.org/mailman

where to find the doc about python regular expression?

2005-06-02 Thread ÒÊÃÉɽÈË
thanks -- http://mail.python.org/mailman/listinfo/python-list